﻿(()=>{var __webpack_modules__={588379:(e,t,i)=>{"use strict";i.d(t,{default:()=>s});var a=i(761508),o=i(961540),r=i(421295),n=browser.iphone||browser.ipad||browser.ipod;function s(e){this.started=!1,this.is_idle=!0,this.activeTimeStart=null,this.cbActiveB=this.cbActive.bind(this),this.cbInactiveB=this.cbInactive.bind(this),this.onVisiblityChange=this.onVisiblityChange.bind(this),this.opts=extend({triggerEvents:"mousemove keydown",onIdleCb:function(){},onUnIdleCb:function(){},focusElement:e.element,element:null,idleTimeout:3e4},e)}function c(e,t,i){(0,o.isMvk)()?window.addEvent(e,t,i,{passive:!0}):window.addEvent(e,t,i)}function l(e,t,i){(0,o.isMvk)()?window.removeEvent(e,t,i,{passive:!0}):window.removeEvent(e,t,i)}function _(){return document.visibilityState||document.webkitVisibilityState}function d(){var e="visibilitychange";return document.visibilityState||(document.webkitVisibilityState?e+="webkit":e=""),e}extend(s.prototype,a.default.prototype),extend(s.prototype,{stop:function(){this.started=!1,l(this.opts.element,this.opts.triggerEvents,this.cbActiveB),(0,o.isMvk)()&&this._isTopLevel()&&d()&&l(document,d(),this.onVisiblityChange),(0,o.isMvk)()&&n||(l(this.opts.focusElement,"focus",this.cbActiveB),l(this.opts.focusElement,"blur",this.cbInactiveB)),clearTimeout(this.setIdleTo),clearTimeout(this.checkIdleCbTo),clearTimeout(this.sendCbTO),this.is_idle=!0,this.opts.parentManager&&this.opts.parentManager.off("idle",this.cbInactiveB)},idle:function(e){this.is_idle=!0,e||this.opts.onIdleCb(),this.emit("idle")},unidle:function(e){this.is_idle=!1,e||this.opts.onUnIdleCb(),this.emit("unidle")},start:function(){this.started=!0,!(0,o.isMvk)()&&browser.mobile||(this.is_idle=!this._isFocused(),this.opts.parentManager&&this.opts.parentManager.on("idle",this.cbInactiveB),(0,o.isMvk)()&&this._isTopLevel()&&d()&&c(document,d(),this.onVisiblityChange),(0,o.isMvk)()&&n||(c(this.opts.focusElement,"focus",this.cbActiveB),c(this.opts.focusElement,"blur",this.cbInactiveB)),clearTimeout(this.checkIdleCbTo),this.checkIdleCb(),this.checkIdleCbTo=setTimeout(this.checkIdleCb.bind(this),this.opts.idleTimeout))},checkIdleCb:function(){this.started&&(c(this.opts.element,this.opts.triggerEvents,this.cbActiveB),clearTimeout(this.setIdleTo),this.setIdleTo=setTimeout(this.cbInactiveB,this.opts.idleTimeout))},cbActive:function(){this.started&&(this.activeTimeStart=(new Date).getTime(),clearTimeout(this.setIdleTo),this.is_idle&&(this.is_idle=!1,clearTimeout(this.sendCbTO),this.sendCbTO=setTimeout(function(){this.emit("unidle"),this.opts.onUnIdleCb&&this.opts.onUnIdleCb()}.bind(this),100)),l(this.opts.element,this.opts.triggerEvents,this.cbActiveB),clearTimeout(this.checkIdleCbTo),this.checkIdleCbTo=setTimeout(this.checkIdleCb.bind(this),this.opts.idleTimeout))},cbInactive:function(){this.started&&(r.screenWakeLocker.isLocked()||(this.activeTimeStart=null,this.is_idle||(this.is_idle=!0,clearTimeout(this.sendCbTO),this.sendCbTO=setTimeout(function(){this.emit("idle"),this.opts.onIdleCb&&this.opts.onIdleCb()}.bind(this),100)),clearTimeout(this.checkIdleCbTo),l(this.opts.element,this.opts.triggerEvents,this.cbActiveB),c(this.opts.element,this.opts.triggerEvents,this.cbActiveB),this.checkIdleCbTo=setTimeout(this.checkIdleCb,this.opts.idleTimeout)))},getActiveTime(){return!this.is_idle&&this.activeTimeStart?(new Date).getTime()-this.activeTimeStart:0},onVisiblityChange(){"visible"===_()?this.cbActiveB():this.cbInactiveB()},_isTopLevel(){var e=this.opts.focusElement;return e===window||e===document},_isFocused(){var e=this.opts.focusElement;if(this._isTopLevel()){var t=_();return"string"==typeof t&&"visible"===t}return document.activeElement===e}})},188015:(e,t,i)=>{"use strict";i.d(t,{random:()=>a});i(781303);function a(){try{if(window.crypto){var e=new Int32Array(1);return crypto.getRandomValues(e),Math.abs(e.reduce(((e,t)=>e+t)))}}catch(e){}return intval(rand(0,2147483647).toFixed(0))}},876109:(e,t,i)=>{"use strict";var a=i(386409);i(588379),i(624817),i(262928),i(367537),i(40415),i(533143),i(669906);window.getWndInner=function(){var e=lastWindowWidth,t=lastWindowHeight,i=(0,a.sbWidth)();return(!1!==lastWndScroll[0]?lastWndScroll[0]:htmlNode.scrollHeight>htmlNode.clientHeight)&&(e-=i+(i?1:0)),[t,e]},window.lastWndScroll=[!1,!1],window.updateWndVScroll=function(){var e=window,t=!1;t=e.boxLayerWrap&&isVisible(boxLayerWrap)?boxLayerWrap.scrollHeight>boxLayerWrap.clientHeight?1:0:e.layerWrap&&isVisible(layerWrap)?layerWrap.scrollHeight>layerWrap.clientHeight?1:0:!(!e.mvLayerWrap||!isVisible(mvLayerWrap))&&(mvLayerWrap.scrollHeight>mvLayerWrap.clientHeight?1:0),each(curRBox.tabs,(function(e){this.options.marginFixedToLayer&&setStyle(this.wrap,{marginRight:hasClass(document.body,"layers_shown")?(0,a.sbWidth)():0})})),t!==lastWndScroll[0]&&(lastWndScroll[0]=t,each(curRBox.tabs,(function(e){this.toRight&&!this.options.marginFixedToLayer&&setStyle(this.wrap,{marginRight:t?(0,a.sbWidth)():0})})))},window.defBox=function(e,t){var i,a='<div class="'+(e.subClass||"")+'"><div class="fc_tab_head"><a class="fc_tab_close_wrap fl_r"><div class="chats_sp fc_tab_close"></div></a><div class="fc_tab_title noselect">%title%</div></div><div id="fc_ctabs_cont"><div class="fc_ctab fc_ctab_active">%content%</div></div></div></div>';i=e.content?'<div class="fc_content_wrap"><div class="fc_content">'+e.content+"</div></div>":e.innerHTML;var o=se(rs(a,{title:e.title,content:i}));i=geByClass1("fc_content",o,"div");var r,n={movable:geByClass1("fc_tab_head",o),hider:geByClass1("fc_tab_close_wrap",o,"a"),startLeft:e.x,startTop:e.y,startHeight:e.height,startWidth:e.width,resizeableH:i,resize:!1,minH:e.minH,onBeforeHide:e.onBeforeHide||function(){},onHide:e.onHide||function(){},onDragEnd:function(e,t){},onResize:function(e,t){}},s=new RBox(o,extend(n,e));return e.content&&(r=new Scrollbar(i,{prefix:"fc_",more:debugLog,nomargin:!0,global:!0,nokeys:!0,right:vk.rtl?"auto":0,left:vk.rtl?0:"auto",onHold:e.onHold})),t({id:s.id,cont:i,update:function(){r&&r.update()}}),s};try{stManager.done("notifier.js")}catch(e){}},40415:(e,t,i)=>{"use strict";i(530522),i(579665),i(95767),i(820075),i(66108),i(21466),i(283946),i(751876),i(59357),i(175115),i(991181),i(176774),i(940851),i(296253);var a=i(386409),o=i(376852),r=i(786067),n=i(40906),s=i(961540),c=i(28238),l=i(329164),_=i(722088),d=i(663825),u=i(188015),f=i(887294),h=i(191040),p=i(460615),v=i(294940),g=i(597903),m=i(454593),b=i(588379),C=i(363035),w=i(163612);function E(){return E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},E.apply(this,arguments)}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],a=!0,o=!1,r=void 0;try{for(var n,s=e[Symbol.iterator]();!(a=(n=s.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==s.return||s.return()}finally{if(o)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return T(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return T(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}var N=1e4,k="fc_msgs_unread",F="WithCollapsedFastChats";function M(){return!curFastChat.version||!curFastChat.tabs}function S(e,t){var i=y(e,6);return{name:i[0],photo:i[1],fname:i[2],hash:i[3],sex:i[4],link:i[5],online:curFastChat.onlines[t]}}window.curFastChat||(window.curFastChat={}),window.FastChat={init:function(e){var t=this;0!==vk.id&&(extend(curFastChat,{tabs:{},needPeers:{},gotPeers:{},needMedia:{},gotMedia:{},ldb:(0,c.mount)(vk.id),myTypingEvents:{},typingEvents:{},inited:!0,options:e,posSeq:0,error_timeout:1,lpInstance:Notifier.getLpInstance()}),delete curFastChat.standby,delete curFastChat.standbyTO,curFastChat.lpInstance.onData((function(){for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];var o=t.getResourcesThatShouldBeLoaded(i),r=o.shouldLoad?t.loadResources(o):Promise.resolve();r.then((()=>{i.forEach((e=>{switch(e.type){case d.TYPING:var i=t.getTab(e.peerId);t.setTyping(e),i&&(t.updateTypings(),t.waitTyping(e).then(t.updateTypings)),t.blinkTyping(e.peerId);break;case d.ADD_MESSAGE:var a=t.getTab(e.peerId);t.setTyping(e),a&&(t.addMessage(t.prepareMessageData(e)),t.scroll(e.peerId),t.blinkTab(e.peerId),t.updateTypings(),t.waitTyping(e).then(t.updateTypings)),t.updateTabUnreadCounter(a,e);break;case d.EDIT_MESSAGE:case d.REPLACE_MESSAGE:var o=e.peerId,r=e.messageId,n=t.getTab(o);n&&n.msgs[r]&&(delete curFastChat.gotMedia[r],t.editMessage(t.prepareMessageData(e)));break;case d.REPLACE_FLAGS:case d.SET_FLAGS:case d.RESET_FLAGS:e.flags&d.FLAG_DELETED&&t.deleteMessage(t.prepareMessageData(e));break;case d.READ_INBOUND:case d.READ_OUTBOUND:t.markMessagesAsRead(e);break;case d.CHAT_CHANGED:case d.CONVERSATION_UPDATED:var s=t.getTab(e.peerId);t.handleEventChatUpdated(s,e);case d.VIDEO_CALL:case d.UNREAD_COUNT:case d.NOTIFY_SETTINGS_CHANGED:case d.EMPTY:case d.RESYNC:case d.REFRESH_LP_KEY:case d.TRANSITION:case d.RESET_PEER:case d.MUTEX:case d.CHANGE_PEER:case d.CHANGE_TAB:case d.FAILED_MESSAGE:case d.RESEND:case d.DELETE_DIALOG:}}))}))})),Notifier.addRecvClbk("fastchat",0,FastChat.lcRecv,!0),Notifier.addRecvClbk("logged_off",0,FastChat.standby,!0),FastChat.lcSend("needSettings",{version:e.version,lang_id:langConfig.id}),clearTimeout(curFastChat.getSettingsTO),curFastChat.getSettingsTO=setTimeout(FastChat.getSettings,300))},getSettings:function(){var e=ls.get("fcFriends"+vk.id);ajax.post("al_im.php",{act:"a_get_fast_chat",friends:e&&e.version,cache_time:FastChat.cachedStickersKeywordsTime()},{onDone:function(t){-1==t.friends?(t.friends_version=e.version,t.friends=e.list):ls.set("fcFriends"+vk.id,{version:t.friends_version,list:t.friends}),FastChat.gotSettings(t),FastChat.sendSettings()},onFail:function(){return!0}})},cachedStickersKeywordsTime:function(){var e=ls.get("stickers_keywords");return e&&e.time?Math.floor(e.time/1e3):0},gotSettings:function(e){e.emoji_stickers&&(window.emojiStickers=e.emoji_stickers),window.Emoji&&Emoji.updateTabs(),e.autoplay_animations&&window.StickersSettings.setAutoplay(e.autoplay_animations),clearTimeout(curFastChat.getSettingsTO),window.lang=extend(window.lang||{},e.lang),extend(curFastChat,e,{lang_id:langConfig.id}),curFastChat.friendsCnt=Object.keys(curFastChat.friends),setTimeout(FastChat.clistCache.pbind(!1),10),FastChat.initUI()},sendSettings:function(){clearTimeout(curFastChat.sendSettingsTO);var e=["friends","friends_version","onlines","tpl","lang","me","version"].reduce(((e,t)=>(e[t]=curFastChat[t],e)),{});curFastChat.sendSettingsTO=setTimeout((function(){FastChat.lcSend("settings",{settings:e})}),curNotifier.is_server?0:irand(50,100))},destroy:function(){return!!curFastChat.inited&&(curFastChat.ldb.unmount(),each(curFastChat.tabs||{},(function(e,t){t.box.destroy()})),curFastChat.clistBox&&curFastChat.clistBox.destroy(),each(curFastChat.el||{},(function(){cleanElems(this)})),clearInterval(curFastChat.updateFriendsInt),clearTimeout(curFastChat.correspondentsTO),clearTimeout(curFastChat.lp_error_to),curFastChat={inited:!1},!0)},isChatOpen:function(e){if(window.curFastChat&&curFastChat.inited&&e){var t=curFastChat.tabs,i=curFastChat.clistBox;if(t&&t[e]&&t[e].box.visible||i&&i.visible)return!0}return!1},standby:function(e){FastChat.destroy(),curFastChat.standby=!0;var t=1;!function i(){if(!curNotifier.is_server)return clearTimeout(curFastChat.standbyTO),void(curFastChat.standbyTO=setTimeout(i,1e3*t));ajax.post("notifier.php?act=a_get_reload",{version:e},{onDone:function(e,t){FastChat.lcSend("gotConfig",{navVersion:e,config:t}),FastChat.gotConfig(e,t)},onFail:function(){return t*=2,clearTimeout(curFastChat.standbyTO),curFastChat.standbyTO=setTimeout(i,1e3*t),!0}})}()},gotConfig:function(e,t){clearTimeout(curFastChat.standbyTO),curFastChat.standby&&setTimeout((function(){if(e>stVersions.nav){debugLog("appending al loader");var i=vk.navPostfix||"";headNode.appendChild(ce("script",{type:"text/javascript",src:`/js/loader_nav${i}${e}_${vk.lang}.js`}))}setTimeout((function(){e<=stVersions.nav?stManager.add(["notifier.js","notifier.css",jsc("web/emoji.js")],(function(){FastChat.init(t)})):setTimeout(arguments.callee,100)}),0)}),curNotifier.is_server?0:irand(1e3,2e3))},updateVersion:function(e){FastChat.lcSend("standby",{version:e}),FastChat.standby(e)},lcSend:function(e,t){Notifier.lcSend("fastchat",extend({act:e,__id:curFastChat.me&&curFastChat.me.id||vk.id},t))},lcRecv:function(e){if(!isEmpty(e)){var t=e.act;e.__id===(curFastChat.me&&curFastChat.me.id||vk.id)&&(delete e.act,delete e.__id,FastChat.lcFeed(t,e))}},lcFeed:function(e,t){switch(e){case"needSettings":curFastChat.version<t.version||t.lang_id==curFastChat.lang_id&&FastChat.sendSettings();break;case"settings":!curFastChat.version&&curFastChat.options&&t.settings.version==curFastChat.options.version&&FastChat.gotSettings(t.settings),clearTimeout(curFastChat.sendSettingsTO);break;case"standby":M()||FastChat.standby(t.version);break;case"gotConfig":FastChat.gotConfig(t.navVersion,t.config);break;case"clistOnlines":M()||FastChat.clistGotOnlines(t);break;case"needPeer":if(M())break;var i=t.id,a=curFastChat.tabs[i],o=curFastChat.friends[i+"_"],r=!1;if(void 0!==a?(r={name:a.name,photo:a.photo,fname:a.fname,hash:a.hash,sex:a.sex,data:a.data,online:a.online},Object.keys(a.msgs).length>0&&(r.history=[a.log.innerHTML,a.msgs])):o&&(r=S(o,i)),!1===r)break;curFastChat.gotPeers[i]=setTimeout((function(){var e={};e[i]=r,FastChat.lcSend("gotPeers",e)}),curNotifier.is_server?0:irand(50,100));break;case"fetchingPeers":if(M())break;each(t,(function(e,t){var i=curFastChat.needPeers[e];i&&(t&i[0])==i[0]&&clearTimeout(i[2])}));break;case"gotPeers":M()||FastChat.gotPeers(t);break;case"stateChange":M()||FastChat.onStateChanged(t);break;case"needMedia":var n=t.msgId,s=curFastChat.gotMedia[n];if(void 0===s||0===s)break;curFastChat.gotMedia[n][3]=setTimeout((function(){FastChat.lcSend("gotMedia",{msgId:n,peer:s[0],text:s[1],msgOpts:s[2]})}),curNotifier.is_server?0:irand(50,100));break;case"fetchingMedia":var c=t.msgId,l=curFastChat.needMedia[c];if(void 0===l||0===curFastChat.gotMedia[c])break;clearTimeout(l[1]),l[1]=setTimeout(FastChat.loadMsgMedia.pbind(l[0],c),1e3);break;case"gotMedia":var _=t.msgId,d=curFastChat.gotMedia[_];isArray(d)&&clearTimeout(d[3]),FastChat.gotMsgMedia(t.peer,_,t.text,t.msgOpts)}},getResourcesThatShouldBeLoaded(e){var t={},i=e.filter((e=>e.type===d.ADD_MESSAGE)),a=e.filter(v.isServiceMsg),o=i.filter((e=>!this.isTabLoaded(e.peerId))).map((e=>e.peerId));function r(e,i){var a=FastChat.getTab(e);(0,g.isChatPeer)(e)&&i&&a&&!a.data.members[i]&&(t[e]?-1===t[e].indexOf(i)&&t[e].push(i):t[e]=[i])}return i.forEach((e=>{this.isTabLoaded(e.peerId)&&r(e.peerId,e.userId)})),a.forEach((e=>{r(e.peerId,+e.kludges.source_mid)})),{shouldLoad:Object.keys(t).length>0||o.length>0,needPeers:o,needMembers:t}},loadResources(e){var t=e.needMembers,i=curFastChat.lpInstance;return i.pause(),this.loadMembers(t).then((()=>i.resume()))},loadMembers(e){if(0===Object.keys(e).length)return Promise.resolve();var t=Object.keys(e).map((t=>`${t}:${e[t].join(",")}`)).join(";");return(0,f.post)(m.CONTROLLER,{act:"a_load_member",need:t}).then((t=>{var i=y(t,1)[0];Object.keys(e).forEach((t=>{var a=this.getTab(t);a&&a.data&&a.data.members&&(a.data.members=e[t].reduce(((e,t)=>{var a=i.find((e=>e.id===t));return e[t]=Object.assign({name_inv_case:a.inv_name,name_kick_case:a.kick_name},a),e}),a.data.members))}))}))},handleEventChatUpdated(e,t){switch(t.updateType){case d.MAIL_CHAT_UPDATE_TYPE_TITLE_CHANGED:case d.MAIL_CHAT_UPDATE_TYPE_AVATAR_CHANGED:var i=[t.peerId,0].join(",");this.loadPeers(i,(e=>{this.updateChatInfo(t.peerId,e)}));case d.MAIL_CHAT_UPDATE_TYPE_ADMIN_GRANTED:case d.MAIL_CHAT_UPDATE_TYPE_FLAGS_CHANGED:case d.MAIL_CHAT_UPDATE_TYPE_PINNED:case d.MAIL_CHAT_UPDATE_TYPE_USER_JOINED:case d.MAIL_CHAT_UPDATE_TYPE_USER_LEFT:case d.MAIL_CHAT_UPDATE_TYPE_USER_KICKED:case d.MAIL_CHAT_UPDATE_TYPE_ADMIN_KICKED:case d.MAIL_CHAT_UPDATE_TYPE_BANNER_CHANGED:case d.MAIL_CHAT_UPDATE_TYPE_KEYBOARD_CHANGED:}},updateChatInfo(e,t){var i=this.getTab(e),a=t[e],o=a.photo,r=a.grid,n=a.name,s=document.querySelector(`#chat_tab_icon_${e} .chat_tab_img`),c=document.createElement(o?"img":"div"),l=i&&i.unread?" ("+i.unread+")":"";i&&i.title&&(i.name=n,i.title.innerHTML=n+l),c.classList.add("chat_tab_img"),r?c.innerHTML=`<div class="chat_tab_grid">${r}</div>`:o&&(c.id="im_dialog_ph"+(e-2e9),c.src=o),s&&s.parentNode.replaceChild(c,s)},blinkEl:function(e,t,i){if(t>10)return i(),!1;t%2==0?animate(e,{opacity:0},400,(function(){FastChat.blinkEl(e,t+1,i)})):animate(e,{opacity:1},400,(function(){setTimeout((function(){FastChat.blinkEl(e,t+1,i)}),400)}))},blinkTyping:function(e){var t=ge("chat_tab_icon_"+e);if(t){var i=geByClass1("chat_tab_typing_wrap",t);fadeIn(i,150,(function(){FastChat.blinkEl(i.firstChild,0,(function(){fadeOut(i,150)}))}))}},imFeed:function(e,t){var i=this.getTab(e);if(!i)return!1;i.auto&&!i.unread&&(i.box._close(!0),delete curFastChat.tabs[e])},tabNotify:function(e,t,i){var a,o=curFastChat.tabs[e];if(e>0&&e<2e9&&(0,n.isFunction)(cur.onPeerStatusChanged)&&cur.onPeerStatusChanged(e,t,i),!(e<=0)&&o&&o.box&&!o.box.minimized){switch(clearTimeout(o.hideNotifyTO),t){case"online":a=(0,r.getLang)("mail_im_user_became_online",3-o.sex),FastChat.blinkTab(e);break;case"offline":a=(0,r.getLang)("mail_im_user_became_offline",3-o.sex),FastChat.blinkTab(e);break;case"unavail":a=(0,r.getLang)("mail_im_not_online",3-o.sex).replace(/\.$/,"")}a=a.replace("{user}",o.fname),val(o.notify,'<div class="fc_tab_notify fc_tab_notify_'+t+'">'+a+"</div>");var s=o.notify.firstChild;clearTimeout(o.hideNotifyTO),o.hideNotifyTO=setTimeout((function(){fadeOut(s,200,(function(){val(o.notify,"")}))}),5e3)}},hideChatCtrl:function(){removeClass(Chat.wrap,"chat_active"),removeEvent(document,"mousedown",FastChat.onDocClick)},showChatCtrl:function(){addClass(Chat.wrap,"chat_active"),setTimeout((function(){addEvent(document,"mousedown",FastChat.onDocClick)}),0)},hideUI:function(){addClass(bodyNode,"chat_onl_hidden")},showUI:function(){removeClass(bodyNode,"chat_onl_hidden")},initUI:function(){if(curFastChat.options){var e=curFastChat.el={},t=getWndInner();re("rb_box_fc_clist"),e.clistWrap=se(curFastChat.tpl.clist),e.clist=geByClass1("fc_contacts",e.clistWrap,"div"),e.clistTitle=geByClass1("fc_tab_title",e.clistWrap,"div"),e.clistOnline=geByClass1("fc_clist_online",e.clistWrap,"div");var i=curFastChat.options.state||!1,a=!curFastChat.friendsCnt||(i&&void 0!==i.clist.min?i.clist.min:t[1]<1200||curFastChat.friendsCnt<5);curFastChat.clistW=270,curFastChat.clistH=299;var n={id:"fc_clist",movable:geByClass1("fc_tab_head",e.clistWrap),hider:geByClass1("fc_tab_close_wrap",e.clistWrap,"a"),startHeight:curFastChat.clistH,startWidth:curFastChat.clistW,resizeableH:e.clist,resize:!1,minH:150,fixed:a,onHide:function(){val("fc_clist_filter",curFastChat.q=""),addClass(curFastChat.clistBox.wrap,"fc_fixed"),curFastChat.clistBox.fixed=!0,FastChat.stateChange({op:"clist_toggled",val:0}),setStyle(curFastChat.clistBox.wrap,{top:"auto",bottom:0,right:72,left:"auto"}),show(e.topLink),FastChat.hideChatCtrl()},onShow:function(){FastChat.showChatCtrl()},onDragEnd:function(e,t){FastChat.stateChange({op:"clist_moved",y:e,x:t})},onResize:function(){curFastChat.clistBoxScroll&&curFastChat.clistBoxScroll.update(!1,!0)}};i&&!a&&(!1!==i.clist.x&&(-1==i.clist.x?n.startRight=0:n.startLeft=t[1]*i.clist.x),!1!==i.clist.y&&(-1==i.clist.y?n.startBottom=0:n.startTop=t[0]*i.clist.y)),a&&(n.noshow=!0),void 0===n.startTop&&void 0===n.startBottom&&(n.startTop=t[0]<800?0:.1*t[0]),void 0===n.startLeft&&void 0===n.startRight&&(n.startRight=0),curFastChat.clistBox=new RBox(e.clistWrap,n),n.noshow||void 0===n.startLeft&&void 0===n.startTop||curFastChat.clistBox._wnd_resize(t[0],t[1],!0),curFastChat.clistBoxScroll=new Scrollbar(e.clist,{prefix:"fc_",scrollChange:FastChat.clistShowMore,nomargin:!0,global:!0,nokeys:!0,right:vk.rtl?"auto":1,left:vk.rtl?1:"auto"}),curFastChat.updateFriendsInt=setInterval(FastChat.clistUpdate,18e4);var s,c=ge("fc_clist_filter");if(placeholderInit(c,{global:!0}),curFastChat.q="",addEvent(c,"keyup "+(browser.opera?"keypress":"keydown"),(function(e){if(e.keyCode===KEY.ESC)return FastChat.clistHide(),cancelEvent(e);var t=FastChat.clistFilterKey(e);if(void 0!==t)return t;curFastChat.q=trim(val(this)),FastChat.clistRender()})),e.clistOnline)bodyNode.appendChild(s=ce("nobr",{className:"fl_l",innerHTML:(0,r.getLang)("mail_im_clist_onlines")},{visibility:"hidden",position:"absolute"})),re(s),addEvent(e.clistOnline,"mouseover",(function(t){(0,o.showTooltip)(this,{text:(0,r.getLang)("mail_im_clist_onlines"),forcetoup:1,shift:[12,4,3],className:"tt_fc_onlines",init:function(){browser.msie&&(e.clistOnline.tt.isFixed=!1)},black:1})})),addEvent(e.clistOnline,"click",(function(e){(e.originalEvent||e).cancelBubble=!0,FastChat.clistToggleOnlines(),FastChat.clistRender()})),i&&i.clist&&i.clist.onlines&&FastChat.clistToggleOnlines(!0);a?FastChat.clistUpdateTitle():FastChat.clistRender(),curFastChat.ready=!0,i&&i.tabs&&each(i.tabs,(function(e,i){e=intval(e);var a={nofocus:1};this.min&&(a.minimized=!0),this.h&&(a.startHeight=this.h*t[0]),this.w&&(a.startWidth=this.w*t[1]),void 0!==this.x&&this.x<=1&&(this.x<0?a.startRight=0:a.startLeft=t[1]*this.x),void 0!==this.y&&this.y<=1&&(this.y<0?a.startBottom=0:a.startTop=t[0]*this.y),i.fx?(a.fixedLoad=!0,FastChat.prepareTabIcon(e,a,!0)):(a.noAnim=!0,FastChat.addPeer(e,!1,!1,a))})),addEvent(Chat.itemsCont,"mouseover",FastChat.itemsTT),addEvent(Chat.itemsCont,"mouseout",FastChat.itemsOut)}},itemsOffset:12,itemsTT:function(e){for(var t=e.target,i=!1;t&&t!=Chat.itemsCont;){if(hasClass(t,"chat_tab_wrap")){i=t;break}t=t.parentNode}if(!i)return clearTimeout(Chat.ttOutTimeout),Chat.ttOutTimeout=!1,!1;var a=i.id.split("_")[3],r=Chat.tabs[a];return!!r&&(curFastChat.activeBox&&curFastChat.activeBox.visible&&curFastChat.activeBox.options.peer==a?(FastChat.itemsOut(),!1):(clearTimeout(Chat.ttOutTimeout),Chat.ttOutTimeout=!1,(0,o.showTooltip)(i,{text:r.name,slideX:15,black:1,asrtl:1,appendEl:Chat.ttNode,className:"tt_black_side",shift:[-58,-37,0],zIndex:10201}),void(Chat.ttPeer=i)))},itemsOut:function(){if(Chat.ttOutTimeout)return!1;Chat.ttOutTimeout=setTimeout((function(){if(Chat.ttOutTimeout=!1,!Chat.ttPeer)return!1;triggerEvent(Chat.ttPeer,"mouseout"),Chat.ttPeer=!1}),0)},stateChange:function(e){ajax.post("al_im.php",extend({act:"a_state_fc",hash:curFastChat.options.state_hash||""},e),{onFail:function(){return!0}}),FastChat.lcSend("stateChange",e)},onStateChanged:function(e){var t=!!e.peer&&curFastChat.tabs[e.peer],i=e.peer?t&&t.box:curFastChat.clistBox,a=getWndInner();switch(e.op){case"added":if(t){delete t.auto;break}e.fixed?FastChat.prepareTabIcon(e.peer,{fixedLoad:!0}):FastChat.addPeer(e.peer);break;case"unfixed":var o={startHeight:intval(a[0]*e.h),startWidth:intval(a[1]*e.w)};-1==e.y?o.startBottom=0:o.startTop=intval(a[0]*e.y),-1==e.x?o.startRight=0:o.startLeft=intval(a[1]*e.x),FastChat.addPeer(e.peer,!1,!1,o);break;case"closed":if(Chat.tabs[e.peer]&&FastChat.closeTabIcon(e.peer),!t||!i)break;i.close();break;case"hidden":if(!t||!i)break;i.close();break;case"minimized":if(!t||!i)break;e.val?i.unminimize():i.minimize();break;case"moved":case"clist_moved":setStyle(i.wrap,{bottom:-1==e.y?0:"auto",top:-1!=e.y?intval(a[0]*e.y):"auto",right:-1==e.x?0:"auto",left:-1!=e.x?intval(a[1]*e.x):"auto"}),i.toBottom=-1==e.y,i.toRight=-1==e.x;break;case"resized":setStyle(i.wrap,{bottom:-1==e.y?0:"auto",top:-1!=e.y?intval(a[0]*e.y):"auto",right:-1==e.x?0:"auto",left:-1!=e.x?intval(a[1]*e.x):"auto"}),i.toBottom=-1==e.y,i.toRight=-1==e.x;var r=intval(a[1]*e.w);setStyle(i.resizeableH,"height",intval(a[0]*e.h)),setStyle(i.resizeableW,"width",r),FastChat.fixResized(t,r);break;case"clist_toggled":e.val?i.show(0,!0):i.hide(0,!0),toggle(curFastChat.el.topLink,!e.val);break;case"onlines_toggled":FastChat.clistToggleOnlines(e.val),FastChat.clistRender()}},onUnidle:function(){curNotifier.version&&curFastChat.clistBox&&(curFastChat.clistBox.visible&&(curFastChat.el.clist.scrollTop<100||curRBox.active!=curFastChat.clistBox.id)?FastChat.clistRender():FastChat.clistUpdateTitle(),each(curFastChat.tabs,(function(e){FastChat.restoreDraft(e)})))},clistUpdate:function(){var e=vkNow();if(curNotifier.is_server&&!(curFastChat.clistUpdatedTs&&e-curFastChat.clistUpdatedTs<6e4)){curFastChat.clistUpdatedTs=e;var t=Object.keys(curFastChat.tabs).concat(Object.keys(Chat.tabs)).join();ajax.post("al_im.php",{act:"a_onlines",peer:t},{onDone:function(e){FastChat.clistGotOnlines(e),FastChat.lcSend("clistOnlines",e)},onFail:()=>!0})}},clistGotOnlines:function(e){var t=curFastChat.onlines,i=[];curFastChat.onlines=e,curNotifier.idle_manager&&curNotifier.idle_manager.is_idle||!curFastChat.tabs&&Chat.tabs||(each(curFastChat.tabs,(function(a){curFastChat.onlines[a]!=t[a]&&(FastChat.tabNotify(a,e[a]?"online":"offline",e[a]),e[a]||(i[a]=1))})),each(Chat.tabs,(function(i){if(curFastChat.onlines[i]!=t[i]){var a=geByClass1("_chat_tab_image",ge("chat_tab_icon_"+i));toggleClass(a,"online",e[i]),toggleClass(a,"mobile",e[i]&&mobPlatforms[e[i]])}})),i=arrayKeyDiff(t,e,i),each(i,(function(e){FastChat.tabNotify(e,"offline")})),FastChat.clistRender())},clistShow:function(){var e=hasClass(Chat.wrap,"chat_active");FastChat.clistRender(),curFastChat.clistBox.visible?curFastChat.clistBox.focus():(curFastChat.activeBox&&curFastChat.activeBox!=curFastChat.clistBox&&curFastChat.activeBox.hide(),curFastChat.clistBox.show(),FastChat.setActive(curFastChat.clistBox),curFastChat.clistBoxScroll&&curFastChat.clistBoxScroll.update(!1,!0),curFastChat.el.topLink&&hide(curFastChat.el.topLink)),elfocus("fc_clist_filter"),FastChat.movePointer(!1,e)},clistHide:function(){curFastChat.clistBox.hide(),curFastChat.activeBox==curFastChat.clistBox&&FastChat.setActive(!1)},clistRender:function(e){var t=[],i=!e,a=1+(e?40:20),o=!1,n=!1,s=!1,c=curFastChat.q;if(c?(s=[],each(FastChat.clistCache(c),(function(){s.push(escapeRE(this))})),s=new RegExp("([ -]|^|s|&nbsp;|\b)("+s.join("|")+")","gi"),o=curFastChat.clistCache[c]||{}):curFastChat.clOnlines&&(o=curFastChat.onlines),curFastChat.clHasMore=!1,each(curFastChat.friends,(function(e){var r=intval(e),c=!o||o[r];if(i){if(c){if(!--a)return curFastChat.clHasMore=!0,!1;t.push(FastChat.clistWrapPeer(r,this,s)),n=r}}else r==curFastChat.clOffset&&(i=!0)})),!1!==n||e||c?c&&!curFastChat.clHasMore&&t.push(FastChat.getCorrespondents(c,s,!1===n)):t.push('<div class="fc_clist_empty">'+(0,r.getLang)(c?"mail_im_clist_notfound":"mail_im_clist_empty")+"</div>"),curFastChat.clOffset=n,e){for(var l=ce("div",{innerHTML:t.join("")}),_=document.createDocumentFragment();l.firstChild;)_.appendChild(l.firstChild);curFastChat.el.clist.appendChild(_),curFastChat.clHasMore||FastChat.clistUpdateTitle(!0)}else val(curFastChat.el.clist,t.join("")),FastChat.clistUpdateTitle(!0),(browser.chrome||browser.safari)&&setTimeout((function(){setStyle(curFastChat.el.clist.firstChild,{width:curFastChat.el.clist.firstChild.clientWidth}),setTimeout((function(){setStyle(curFastChat.el.clist.firstChild,{width:""})}),0)}),0);if(curFastChat.clSel){var d=ge("fc_contact"+curFastChat.clSel);d?FastChat.clistPeerOver(d,1):curFastChat.clSel=!1}else{var u=geByClass1("fc_contact",curFastChat.el.clist);FastChat.clistPeerOver(u,1)}curFastChat.clistBoxScroll&&curFastChat.clistBoxScroll.update()},clistWrapPeer:function(e,t,i){var a,o,r=curFastChat.tabs[e]?curFastChat.tabs[e].unread:0,n=curFastChat.onlines[e],s=onlinePlatformClass(n),c=(t[0]||"").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return i&&(c=c.replace(i,'$1<em class="fc_clist_hl">$2</em>')),e>0&&e<2e9?(a="/id"+e,o='onmousemove="FastChat.clistPeerOver(this.parentNode, 2);"  onmouseout="FastChat.clistPeerOver(this.parentNode, 1);"'):(a="/im?sel="+e,o=""),'<a href="'+a+'" class="fc_contact clear_fix" id="fc_contact'+e+'" onclick="return FastChat.selectPeer('+e+', event, { entrypoint: \'fastchat_search\' });" onmousedown="event.cancelBubble = true;" onmouseover="FastChat.clistPeerOver(this, 1, event);"  onmouseout="FastChat.clistPeerOver(this, 0, event);"><span class="fc_contact_photo'+s+'" '+o+">"+(e>2e9&&t[3]?t[3]:'<img src="'+Notifier.fixPhoto(t[1])+'" class="fc_contact_photo"/>')+'</span><span class="fc_contact_status"></span><span class="fc_contact_name">'+c+'<span id="fc_contact_unread'+e+'" class="fc_contact_unread">'+(r?" <b>+"+r+"</b>":"")+"</span></span></a>"},clistPeerOver:function(e,t,i){if(e&&checkOver(i,e)){var a=e.id.substr(10);curFastChat.clSel&&t&&curFastChat.clSel!=a&&FastChat.clistPeerOver(ge("fc_contact"+curFastChat.clSel),0),toggleClass(e,"fc_contact_over",t),t?curFastChat.clSel=a:curFastChat.clSel==a&&(curFastChat.clSel=!1)}},authorOver:function(e){var t=gpeByClass("fc_tab_log",e),i=e.getBoundingClientRect().top,a=t.getBoundingClientRect().top,r=e.getAttribute("data-title"),n=!1;if(i-a<10&&(n=!0),r){var s=e.getAttribute("data-date");s&&(r+="<br>"+s);var c=gpeByClass("rb_box_wrap",e).querySelector(".tt-fastchat-wrap");(0,o.showTooltip)(e,{text:'<div class="fc_author_tt">'+r+"</div>",black:1,center:1,forcetodown:n,appendEl:c,shift:[1,8,0]})}},getCorrespondents:function(e,t,i){return clearTimeout(curFastChat.correspondentsTO),curFastChat.correspondents&&void 0!==curFastChat.correspondents[e]?FastChat.wrapCorrespondents(curFastChat.correspondents[e])||i&&'<div class="fc_clist_empty">'+(0,r.getLang)("mail_im_clist_notfound")+"</div>"||"":(curFastChat.correspondentsTO=setTimeout(FastChat.loadCorrespondents.pbind(e,t),100),'<div id="fc_correspondents"></div>')},loadCorrespondents:function(e,t){e==curFastChat.q&&ajax.post("hints.php",{act:"a_json_friends",str:e,from:"fc",allow_multi:1},{onDone:function(i){curFastChat.correspondents||(curFastChat.correspondents={});var a,o={};if(each(i,(function(){a=this[3]+"_",curFastChat.friends[a]||(o[a]=[this[1],this[2],this[3],this[4]||""])})),curFastChat.correspondents[e]=o,e==curFastChat.q){var n=ge("fc_correspondents");if(n){var s=n.parentNode,c=ce("div",{innerHTML:FastChat.wrapCorrespondents(o,t)}),l=document.createDocumentFragment();if(c.firstChild)for(;c.firstChild;)l.appendChild(c.firstChild);else s.firstChild==n&&l.appendChild(ce("div",{className:"fc_clist_empty",innerHTML:(0,r.getLang)("mail_im_clist_notfound")}));s.replaceChild(l,n),FastChat.clistUpdateTitle(!0),curFastChat.clistBoxScroll&&curFastChat.clistBoxScroll.update()}}}})},wrapCorrespondents:function(e,t){var i=[];return each(e,(function(e){i.push(FastChat.clistWrapPeer(intval(e),this,t))})),i.join("")},updateFriends:function(e){if(window.Chat&&Chat.inited){var t=Chat.onl;t&&(e>0?(val(t,e),show(Chat.wrap)):hide(Chat.wrap))}},onDocClick:function(e){if(curFastChat.activeBox){var t=e.target;if(curBox())return!0;for(;t;){if("fc_tab_wrap"==t.className||-1!==["chat_onl_wrap","custom_menu_cont","layer_wrap","box_layer_wrap","wk_layer_wrap"].indexOf(t.id))return!0;t=t.parentNode}var i=curFastChat.tabs[curFastChat.activeBox.options.peer];if(i&&(trim(Emoji.editableVal(i.txt))||i.imMedia&&i.imMedia.getMedias().length))return!0;curFastChat.activeBox.hide()}},clistCache:function(e){if(e){var t,i,a,o,n,s,c=[e];if((i=(0,r.parseLatin)(e))&&c.push(i),(i=(0,r.parseLatKeys)(e))&&c.push(i),(i=(0,r.parseCyr)(e))&&c.push(i),void 0!==curFastChat.clistCache[e])return c;for(var l in s=curFastChat.clistCache[e]={},c)if(c.hasOwnProperty(l)&&(t=c[l],a=curFastChat.clistCache[" "+t.charAt(0).toLowerCase()]))for(var _ in o=new RegExp("(^|\\s|\\()"+escapeRE(t),"gi"),a)if(a.hasOwnProperty(_)){if(n=curFastChat.friends[_+"_"],!isArray(n))continue;null!==n[0].match(o)&&(s[_]=1)}return s._num=Object.keys(s).length,c}var d,u,f;for(var h in curFastChat.clistCache={},curFastChat.friends)if(curFastChat.friends.hasOwnProperty(h))for(d=curFastChat.friends[h][0],h=intval(h),u=0;f=" "+d.charAt(u).toLowerCase(),curFastChat.clistCache[f]||(curFastChat.clistCache[f]={}),curFastChat.clistCache[f][h]=1,-1!==(u=d.indexOf(" ",u+1));)++u},clistShowMore:function(){if(curFastChat.clHasMore){var e=curFastChat.el.clist;e.scrollTop+3*e.clientHeight>e.scrollHeight&&FastChat.clistRender(!0)}},clistUpdateTitle:function(e){var t=0,i=0;for(var a in curFastChat.friends)curFastChat.onlines[intval(a)]?(i++,t++):curFastChat.clOnlines||t++;var o=window.newVal=(i?(0,r.getLang)("mail_im_X_onlines_title",i):(0,r.getLang)("mail_im_onlines_title")).toString();FastChat.updateFriends(i),val(curFastChat.el.clistTitle,o),val(curFastChat.el.topLink,o.toLowerCase()),curFastChat.clistBoxScroll&&(!curFastChat.clHasMore&&e?t=curFastChat.el.clist.childNodes.length:curFastChat.q&&(t=intval((curFastChat.clistCache[curFastChat.q]||{})._num)),curFastChat.clistBoxScroll.options.contHeight=50*t)},clistToggleOnlines:function(e){void 0===e&&(e=!curFastChat.clOnlines,FastChat.stateChange({op:"onlines_toggled",val:e?1:0})),toggleClass(curFastChat.el.clistOnline,"fc_clist_online_active",e),curFastChat.clOnlines=e},clistFilterKey:function(e){var t;switch(e.keyCode){case KEY.DOWN:case KEY.UP:if("keyup"!==e.type){var i;if(t=curFastChat.clSel&&ge("fc_contact"+curFastChat.clSel)){var a=e.keyCode===KEY.DOWN?"nextSibling":"previousSibling";i=t;do{i=i[a]}while(i&&(1!==i.nodeType||!hasClass(i,"fc_contact")))}else curFastChat.clSel||e.keyCode!==KEY.DOWN||(i=geByClass1("fc_contact",curFastChat.el.clist,"a"));if(i&&i!==t){FastChat.clistPeerOver(i,1);var o=curFastChat.el.clist;i.offsetTop+16>o.clientHeight+o.scrollTop?(o.scrollTop=i.offsetTop+16-o.clientHeight,curFastChat.clistBoxScroll.update()):i.offsetTop-36<o.scrollTop&&(o.scrollTop=i.offsetTop-36,curFastChat.clistBoxScroll.update())}}break;case KEY.LEFT:case KEY.RIGHT:return!0;case KEY.ENTER:if("keyup"==e.type||!(t=curFastChat.clSel&&ge("fc_contact"+curFastChat.clSel)))break;if(e.ctrlKey||e.metaKey&&browser.mac){var r=(0,s.getHostName)().replace(".","\\.");nav.go(t.href.match(new RegExp(`\\b(vkontakte\\.ru|${r})(\\/[^\\/]+?)$`))[2])}else FastChat.selectPeer(curFastChat.clSel);case KEY.ESC:if("keyup"!=e.type){var n=ge("fc_clist_filter"),c=val(n)||curFastChat.clSel;n.blur(),val(n,curFastChat.q=""),curFastChat.clSel=!1,c&&FastChat.clistRender()}break;default:return}return cancelEvent(e)},prepareTabIcon:function(e,t,i){var a=curFastChat.friends&&curFastChat.friends[e+"_"];if(a){var o=S(a,e);FastChat.addTabIcon(e,o,i)}else{curFastChat.needPeers[e]=[3,!1,setTimeout(FastChat.getPeers,irand(150,200)),t]}},addTabIcon:function(e,t,i){if(Chat.itemsCont&&!Chat.tabs[e]){var a=e>2e9,o=a?t.data.members_grid_fc||"":`<img class="chat_tab_img" src="${t.photo}"/>`,r=a?"im?sel=c"+(e-2e9):t.alink||"/id"+e,n=onlinePlatformClass(t.online),s=se('<a class="chat_tab_wrap'+(i?"":" chat_tab_beforeanim")+'" id="chat_tab_icon_'+e+'" href="'+r+'" onclick="FastChat.itemsOut();return FastChat.togglePeer('+e+', event);"><div class="chat_tab_imgcont _chat_tab_image'+n+'"><div class="chat_tab_close" onclick="return FastChat.closeTabIcon('+e+', event)"></div>'+o+'</div><div class="chat_tab_typing_wrap"><div class="chats_sp chat_tab_typing_icon"></div></div><div class="chat_tab_counter"></div></a>');Chat.itemsCont.insertBefore(s,Chat.itemsCont.firstChild),Chat.tabs[e]={el:s,name:t.name},addClass(Chat.wrap,"chat_expand"),i||removeClass(s,"chat_tab_beforeanim"),FastChat.checkChatHeight(),Chat.scrollNode.scrollTop=0}},checkChatHeight:function(){var e=getSize(Chat.itemsCont)[1];function t(){addEvent(Chat.scrollNode,browserFeatures.wheelEvent,FastChat.scrollWrap)}function i(){removeEvent(Chat.scrollNode,browserFeatures.wheelEvent,FastChat.scrollWrap)}Chat.lastHeight=e,e>Chat.maxHeight?(Chat.fixH||(Chat.fixH=!0,addClass(Chat.scrollNode,"chat_fix_height"),setStyle(Chat.scrollNode,{height:Chat.maxHeight}),addEvent(Chat.scrollNode,"mouseenter",t),addEvent(Chat.scrollNode,"mouseleave",i),FastChat.checkShadow()),Chat.scrollNode.scrollTop=e-Chat.maxHeight):Chat.fixH&&(Chat.fixH=!1,removeClass(Chat.scrollNode,"chat_fix_height"),setStyle(Chat.scrollNode,{height:"auto"}),removeEvent(Chat.scrollNode,browserFeatures.wheelEvent,FastChat.scrollWrap),removeEvent(Chat.scrollNode,"mouseenter",t),removeEvent(Chat.scrollNode,"mouseleave",i),FastChat.checkShadow())},checkShadow:function(){var e=intval(Chat.scrollNode.scrollTop);e&&Chat.fixH?Chat.shadowTop||(addClass(Chat.wrap,"chat_scroll_top"),fadeIn(geByClass1("chat_cont_sh_top",Chat.wrap),200),Chat.shadowTop=!0):Chat.shadowTop&&(fadeOut(geByClass1("chat_cont_sh_top",Chat.wrap),200),Chat.shadowTop=!1),Chat.lastHeight-e>Chat.maxHeight&&Chat.fixH?Chat.shadowBottom||(fadeIn(geByClass1("chat_cont_sh_bottom",Chat.wrap),200),Chat.shadowBottom=!0):Chat.shadowBottom&&(fadeOut(geByClass1("chat_cont_sh_bottom",Chat.wrap),200),Chat.shadowBottom=!1)},scrollWrap:function(e){e||(e=window.event);var t=0;return e.wheelDeltaY||e.wheelDelta?t=(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&(t=10*-e.detail),Chat.scrollNode.scrollTop-=t,curFastChat.activeBox==curFastChat.clistBox?(curFastChat.pointerMargin=0,FastChat.setPointer(!1,curFastChat.pointerMargin,curFastChat.prevPointer)):(curFastChat.pointerMargin=-Chat.scrollNode.scrollTop,FastChat.setPointer(!0,curFastChat.pointerMargin,curFastChat.prevPointer)),FastChat.checkShadow(),setStyle(Chat.ttNode,{top:-Chat.scrollNode.scrollTop}),cancelEvent(e)},togglePeer:function(e,t){return curFastChat.activeBox&&curFastChat.activeBox.options.peer==e?(curFastChat.activeBox.hide(),FastChat.setActive(!1),!1):FastChat.selectPeer(e,t,{entrypoint:"fastchat_icon"})},selectPeer:function(e,t,i){if(checkEvent(t))return!0;var a=hasClass(Chat.wrap,"chat_active");if(curFastChat.tabs&&curFastChat.tabs[e]){var o=curFastChat.tabs[e].box;o.minimized&&o.unminimize(!0),FastChat.activateTab(e),FastChat.movePointer(e,a)}else i||(i={}),i.fixed=!0,i.onPeerAdded=function(){FastChat.movePointer(e,a)},i.onHistoryLoaded=FastChat.readLastMessages.pbind(e),FastChat.addPeer(e,!1,!0,i);return curFastChat.tabs[e]&&curFastChat.tabs[e].iman&&(curFastChat.tabs[e].entrypoint=i&&i.entrypoint,curFastChat.tabs[e].iman.unidle()),FastChat.trackActivity("open"),!1},closeTabIcon:function(e,t,i){curFastChat.activeBox&&curFastChat.activeBox.options.peer==e&&!i&&(curFastChat.activeBox.hide(),FastChat.setActive(!1));var a=ge("chat_tab_icon_"+e);addClass(a,"chat_tab_hiding"),delete Chat.tabs[e],curFastChat.tabs[e]&&curFastChat.tabs[e].box.options.fixed&&(curFastChat.tabs[e].iman.stop(),delete curFastChat.tabs[e]);return animate(a,{height:0,opacity:0},{duration:100,onComplete:function(){re(a),a&&(a=!1,curFastChat.activeBox&&FastChat.movePointer(curFastChat.activeBox.options.peer,!0));var e=Chat.scrollNode.scrollTop;FastChat.checkChatHeight(),Chat.scrollNode.scrollTop=e}}),i||FastChat.stateChange({op:"closed",peer:e}),Object.keys(Chat.tabs).length||removeClass(Chat.wrap,"chat_expand"),FastChat.itemsOut(),cancelEvent(t)},getPointerShift:function(e,t,i){var a=i-t,o=Chat.maxHeight+32;return e&&a<62?a-62:e&&a>o?a-o:0},setPointer:function(e,t,i){if(!curFastChat.activeBox)return!1;var a=FastChat.getPointerShift(e,t,i),o=geByClass1("fc_tab_pointer",curFastChat.activeBox.wrap);return setStyle(o,{marginTop:t+a}),a},movePointer:function(e,t){if(!curFastChat.activeBox)return!1;var i,a,o=geByClass1("fc_pointer_offset",curFastChat.activeBox.wrap);if(e){var r,n=ge("chat_tab_icon_"+e);if(!n)return!1;r=!Chat.fixH&&n.nextSibling?getXY(n.nextSibling)[1]-50:n.nextSibling||Chat.fixH?getXY(n)[1]+Chat.scrollNode.scrollTop:getXY(ge("chat_tab_wrap"))[1]-50,i=23+getXY(Chat.cont)[1]-r,a=-Chat.scrollNode.scrollTop}else i=28,a=0;var s=FastChat.setPointer(e,a,i);if(t){if(curFastChat.prevPointer){var c=FastChat.getPointerShift(!0,a+s,curFastChat.prevPointer);setStyle(o,{bottom:curFastChat.prevPointer-c+s})}animate(o,{bottom:i},{duration:100})}else setStyle(o,{bottom:i});curFastChat.prevPointer=i},setActive:function(e){curFastChat.activeBox=e,e&&FastChat.moveBoxesLeft(e.pos[1])},moveBoxesLeft:function(e,t){e-=8;var i=!1,a=0;for(var o in curFastChat.tabs)if(curFastChat.tabs.hasOwnProperty(o)){var r=curFastChat.tabs[o];if(t||(r.box.movedLeft=!1),!r||r.box.options.fixed||!r.box.toBottom||r.box.movedLeft||r.box.noMove)continue;var n=r.box.pos;n[1]+n[3]>=e&&n[1]>a&&(i=r,a=n[1])}if(i){var s=e-i.box.pos[3],c=i.box.pos[0];s<0&&(s=0),i.box.movedLeft=!0,animate(i.box.wrap,{left:s},200),i.box.pos=[c,s,i.box.pos[2],i.box.pos[3]];var l=getWndInner();FastChat.stateChange({op:"moved",peer:i.box.options.peer,y:c/l[0],x:s/l[1]}),s&&FastChat.moveBoxesLeft(s,!0)}else FastChat.moveLeftY=0},moveBoxAway:function(e,t){for(var i=e.pos[3],a=t-e.pos[3]-20,o=e.pos[0],r=!1;a>0&&!r;)for(var n in r=!0,curFastChat.tabs)if(curFastChat.tabs.hasOwnProperty(n)){var s=curFastChat.tabs[n].box.pos;s[0]+s[2]/2>o&&s[1]+s[3]>a&&s[1]<a+i&&(a-=s[3],r=!1)}a<0&&(a=positive(Math.random()*t)),animate(e.wrap,{left:a},300);var c=getWndInner();FastChat.stateChange({op:"moved",peer:e.options.peer,y:o/c[0],x:a/c[1]})},pinTab:function(e,t,i){var a=-1==e?curFastChat.clistBox:curFastChat.tabs[e].box;a.options.fixed=!1,removeClass(a.wrap,"fc_fixed"),FastChat.hideChatCtrl(),FastChat.setActive(!1);var o=a.wrap.offsetTop,r=a.wrap.offsetLeft-10;setStyle(a.wrap,{left:a.wrap.offsetLeft,top:a.wrap.offsetTop,right:"auto",bottom:"auto"}),i||animate(a.wrap,{left:r,top:o},300),a.pos=[o,r,a.pos[2],a.pos[3]],a.toRight=!1,a.toBottom=!0,addClass(a.wrap,"fc_tobottom");var n=a.resizeableW.clientWidth-intval(getStyle(a.resizeableW,"paddingRight"))-intval(getStyle(a.resizeableW,"paddingLeft")),s=a.resizeableH.clientHeight-intval(getStyle(a.resizeableH,"paddingBottom"))-intval(getStyle(a.resizeableH,"paddingTop")),c=getWndInner();-1==e?FastChat.stateChange({op:"clist_toggled",val:1,y:a.toBottom?-1:a.pos[0]/c[0],x:a.toRight?-1:a.pos[1]/c[1]}):FastChat.stateChange({op:"unfixed",peer:e,y:a.toBottom?-1:a.pos[0]/c[0],x:a.toRight?-1:a.pos[1]/c[1],h:s/c[0],w:n/c[1]}),a.noMove=!0,FastChat.moveBoxesLeft(r),a.noMove=!1},addPeer:function(e,t,i,a){a||(a={});var o=curFastChat.friends&&curFastChat.friends[e+"_"],r=0;if(i?FastChat.stateChange({op:"added",peer:e,fixed:a.fixed}):curNotifier.idle_manager&&!curNotifier.idle_manager.is_idle&&t&&(i=!0),o){var n=S(o,e);FastChat.addTabIcon(e,n,a.noAnim),FastChat.addBox(e,n,a),t?(curFastChat.tabs[e].auto=1,FastChat.imFeed(e,t)):(a&&a.nofocus||FastChat.activateTab(e),curFastChat.onlines[e]||FastChat.tabNotify(e,"unavail"),r|=2)}else r=3;r&&(i?(curFastChat.needPeers[e]=[r,t,!1,a],FastChat.getPeers()):(curFastChat.needPeers[e]=[r,t,setTimeout(FastChat.getPeers,irand(150,200)),a],FastChat.lcSend("needPeer",{id:e,mask:r})))},getPeers(){var e=[],t={};Object.keys(curFastChat.needPeers||{}).forEach((i=>{var a=y(curFastChat.needPeers[i],3),o=a[0],r=a[2];e.push(i,o),r&&clearTimeout(r),t[i]=o})),e.length&&(FastChat.lcSend("fetchingPeers",t),FastChat.loadPeers(e.join(","),(function(e){FastChat.gotPeers(e),FastChat.lcSend("gotPeers",e)})))},gotPeers:function(e){M()||each(curFastChat.needPeers,(function(t){if(e[t]){e[t]<2e9&&(curFastChat.friends[t+"_"]=[e[t].name,e[t].photo,e[t].fname,e[t].hash,intval(e[t].sex)]);var i=this[1],a=this[3];2&this[0]&&void 0===e[t].history||(clearTimeout(this[2]),delete curFastChat.needPeers[t]),curFastChat.tabs[t]?FastChat.gotHistory(t,e[t].history):a.fixedLoad?FastChat.addTabIcon(t,e[t]):(FastChat.addTabIcon(t,e[t]),FastChat.addBox(t,e[t],a),i?(curFastChat.tabs[t].auto=1,FastChat.imFeed(t,i)):(2&this[0]&&FastChat.gotHistory(t,e[t].history),a&&a.nofocus||FastChat.activateTab(t))),a.onHistoryLoaded&&a.onHistoryLoaded()}}))},gotHistory:function(e,t){if(isArray(t)&&t.length&&t[0]){var i=curFastChat.tabs[e],a=t[0],o=t[1];i.offset=t[2],extend(i.msgs,o),each(o,(function(e,t){!t[0]&&t[1]&&i.unread++})),val(i.log,a),i.logWrap.scrollTop=i.logWrap.scrollHeight,setTimeout((function(){i.logWrap.scrollTop=i.logWrap.scrollHeight,i.scroll&&i.scroll.update(!1,!0)}),10)}},decHashCb:function(e){var t;t=e,curFastChat.decodedHashes[t]=function(e){for(var t=ge?"":"___",i=0;i<e.length;++i)t+=e.charAt(e.length-i-1);return geByClass?t:"___"}(t.substr(t.length-5)+t.substr(4,t.length-12))},decodehash:function(e){return curFastChat.decodedHashes||(curFastChat.decodedHashes={}),curFastChat.decodedHashes[e]||FastChat.decHashCb(e),curFastChat.decodedHashes[e]},loadPeers(e,t){ajax.post("al_im.php",{act:"a_get_fc_peers",peers:e},{onDone:t})},sendTyping:function(e){var t=intval(e),i=this.getTab(t),a=Date.now();t<=-2e9||!i||curFastChat.myTypingEvents[t]&&a-curFastChat.myTypingEvents[t]<5e3||(curFastChat.myTypingEvents[t]=a,ajax.post("al_im.php",{act:"a_activity",type:"typing",peer:t,hash:i.sendhash,from:"fc"}))},setTyping(e){var t=this.getTab(e.peerId),i=e.type===d.ADD_MESSAGE;if(t&&t.typing&&i){var a=t.typing.userIds.filter(((t,i)=>t!==e.userId));0===a.length?delete t.typing:t.typing=Object.assign(t.typing,{userIds:a})}else t&&!i&&(e.ts=Date.now()/1e3,t.typing=Object.assign(e,{userIds:(e.userIds||[]).filter(((e,t)=>e!==vk.id))}))},waitTyping(e){return(0,h.pause)(m.ACTIVITY_PERIOD+2).then((()=>{var t=this.getTab(e.peerId);t&&t.typing&&(Date.now()-1e3*t.typing.ts>=1e3*m.ACTIVITY_PERIOD&&delete t.typing)}))},updateTypings(){var e=curFastChat.tabs||{};Object.keys(e).forEach((e=>{FastChat.updateTyping(e)}))},updateTyping(e,t){var i=this.getTab(e),a=ge("fc_tab_typing"+e),o=geByClass1("_fc_tab_typing_progress",a),r=geByClass1("_fc_tab_typing_name",a);if(i.typing&&i.typing.userIds.length>0){var n=this.formatTyping(i.typing);val(r,n),show(o)}else val(r,""),hide(o);t?setStyle(a,"opacity",1):fadeTo(a,200,1)},formatTyping(e){var t=e.peerId,i=e.userIds,a=this.getTab(t),o=i[0],n=(0,g.isChatPeer)(t)?a.data.members[o]:a,s=e=>e.fname||e.name||"";if(1===i.length||!(0,g.isChatPeer)(t))return langSex(n.sex,(0,r.getLang)("mail_im_typing")).replace("{user}",s(n));var c=i[i.length-1],l=(0,g.isChatPeer)(t)?a.data.members[c]:a;return(0,r.getLang)("mail_im_multi_typing").replace("{users}",s(n)).replace("{last_user}",s(l))},markMessagesAsRead(e){var t=e.type,i=e.peerId,a=e.upToId,o=e.unread,r=this.getTab(i);r&&(t===d.READ_INBOUND&&(r.inUpTo=a),t===d.READ_OUTBOUND&&(r.outUpTo=a),r.unread=o,this.updateUnreadMessagesInTab(i,a,t===d.READ_OUTBOUND)),this.updateTabUnreadCounterElement(r||{unread:0},i)},updateUnreadMessagesInTab(e,t,i){var a=this.getTab(e),o=i?".fc_msgs_unread.fc_msgs_out":".fc_msgs_unread:not(.fc_msgs_out)";if(a&&a.log){var r=a.log.querySelectorAll(o);Array.prototype.forEach.call(r,(e=>{+e.getAttribute("data-message-id")<=t&&e.classList.remove(k)}))}},readLastMessages(e){var t=FastChat.getTab(e);if(e&&t){if(!t.markingRead&&t.unread){var i=[];for(var a in t.msgs)!t.msgs[a][0]&&t.msgs[a][1]&&i.push(a);i.length>0&&FastChat.markRead(e,i)}t.unread=0,FastChat.updateTabUnreadCounterElement(t,e)}},markRead:function(e,t){var i=this.getTab(e);i.markingRead=!0,ajax.post("al_im.php",{act:"a_mark_read",peer:e,ids:t,hash:i.sendhash,from:"fc"},{onDone:function(a){for(var o in i.markingRead=!1,t){if(t.hasOwnProperty(o))if("continue"===function(){var e=t[o],a=ge("fc_msg"+e),r=a&&a.parentNode;if(!a)return"continue";i.msgs[e]&&i.msgs[e][1]&&(i.msgs[e][1]=0,i.msgs[e][0]||i.unread--),removeClass(a,"fc_msg_unread"),hasClass(r.parentNode,"fc_msgs_unread")&&each(r.childNodes,(function(){if(!hasClass(this,"fc_msg_unread"))return removeClass(r.parentNode,"fc_msgs_unread"),!1}))}())continue}i.unread=0,FastChat.updateTabUnreadCounterElement(i,e)},onFail:function(){i.markingRead=!1}})},getMessageText(e,t){var i=e||"",a=Math.round(1e9*Math.random()).toString(16),o={},r=0;return i=(i=(0,_.replaceHyperLinks)(i,_.linksReplacer.bind(null,!1))).replace(/(<a.+?<\/a>)/gi,(e=>{var t=`!link_${r}_${a}!`;return o[t]=e,r++,t})),i=(0,_.replaceMentions)(i),i=(0,_.replaceEmailLinks)(i),i=(0,_.replaceHashtags)(i,(e=>`<a href="/im?sel=${t}&st=${encodeURIComponent(e)}">${e}</a>`)),Object.keys(o).forEach((e=>{i=i.replace(e,o[e])})),i=Emoji.emojiToHTML(i,1)},getEditCont:function(e){return stManager.add([jsc("web/emoji.js")]),'<div class="emoji_cont _emoji_field_wrap">'+Emoji.tplSmile((0,r.getLang)("mail_emoji_hint"))+'<div class="fc_editable dark" tabindex="0" contenteditable="true" placeholder="'+(0,r.getLang)("mail_chat_placeholder")+'"></div></div>'},getInputValue:function(e){return Emoji?Emoji.editableVal(e):""},onTxtResize:function(e){var t=curFastChat.tabs[e],i=geByClass1("fc_tab_txt",t.wrap),a=getSize(i)[1];if(a>40){var o=positive(a-40),r=intval(getSize(t.box.resizeableH)[1]);r+t.hDiff-o<40&&(o=r+t.hDiff-40),setStyle(t.box.resizeableH,{height:r+(t.hDiff||0)-o}),t.hDiff=o,FastChat.fixResized(t,t.wrap.clientWidth,!0)}else if(t.hDiff){var n=intval(getSize(t.box.resizeableH)[1]);setStyle(t.box.resizeableH,{height:n+t.hDiff}),t.hDiff=0,FastChat.fixResized(t,t.wrap.clientWidth,!0)}},initTab:function(e,t,i){var a=geByClass1("fc_editable",i),o=curFastChat.tabs[e]={name:t.name,fname:t.fname,photo:t.photo,link:t.alink||"/id"+e,hash:t.hash,sendhash:FastChat.decodehash(t.hash),sex:t.sex||0,data:t.data||{},online:t.online,msgs:{},msgscount:0,unread:0,box:!1,wrap:i,editable:1,txt:a,txtWrap:a.parentNode.parentNode,logWrap:geByClass1("fc_tab_log",i),log:geByClass1("fc_tab_log_msgs",i),notify:geByClass1("fc_tab_notify_wrap",i),title:geByClass1("fc_tab_title",i)},n=30;if(o.addMediaBtn=geByClass1("fc_tab_attach",i),o.editable)cur.t=o,o.emojiId=Emoji.init(o.txt,{controlsCont:geByClass1("fc_tab_txt_wrap",i),ttDiff:-46,ttShift:0,rPointer:!0,global:!0,noRce:!0,peer:e,isChat:!0,noCtrlSend:!0,ref:"fast_chat",onSend:FastChat.send.pbind(e),checkEditable:FastChat.checkEditable,onResize:function(){FastChat.onTxtResize(e)},addMediaBtn:o.addMediaBtn,onShow:function(){cssAnim(o.scroll.scrollbar,{opacity:0},{duration:400})},onHide:function(){cssAnim(o.scroll.scrollbar,{opacity:1},{duration:400})},onEsc:function(e){return o.box.hide(),cancelEvent(e)},onStickerSend:function(t,i){FastChat.send(e,t,i)}});else{autosizeSetup(o.txt,{minHeight:15,maxHeight:42}),o.txt.autosize.options.onResize=function(e){if(!o.box.minimized){var t=42==e?42:15;t!=e&&setStyle(o.txt,"height",t),t!=n&&(setStyle(o.logWrap,"height",o.logWrap.clientHeight-t+n),n=t,o.scroll&&o.scroll.update(!1,!0))}}}return o.imPeerMedias={},o.imSortedMedias={},o.previewEl=geByClass1("fc_tab_preview",i),stManager.add(["page.js","page.css",jsc("web/ui_media_selector.js"),"ui_media_selector.css"],(function(){var t=[["photo",(0,r.getLang)("profile_wall_photo")],["video",(0,r.getLang)("profile_wall_video")],["audio",(0,r.getLang)("profile_wall_audio")],["doc",(0,r.getLang)("profile_wall_doc")],["map",(0,r.getLang)("profile_wall_map")]];o.imMedia=new MediaSelector(o.addMediaBtn,o.previewEl,t,{limit:10,hideAfterCount:0,maxShown:0,mail:1,tooltip:1,topOffset:0,forceUp:1,global:1,toId:vk.id,from:"message"}),o.imMedia.onChange=setTimeout.pbind((function(){if(curFastChat.sendOnUpload)FastChat.send(curFastChat.sendOnUpload),curFastChat.sendOnUpload=void 0;else{var t=(0,l.loadDraftForPeer)(curFastChat.ldb,e);t.removeAllAttaches(),o.imMedia.getMedias().forEach((e=>t.addAttach(e[0],e[1]))),t.destroy()}FastChat.onTxtResize(e)}),0)})),o},addBox:function(e,t,i){if(void 0===curFastChat.tabs[e]){var o=FastChat.getEditCont(Emoji.last);i=i||{},curFastChat.tabs[e]={};var r=se(rs(FastChat.tplBox,{id:e,name:t.name,myphoto:Notifier.fixPhoto(curFastChat.me.photo,!0),cont:o}));i.fixed&&curFastChat.activeBox&&curFastChat.activeBox.hide(0,!1,{noState:!0});var n=FastChat.initTab(e,t,r),s=getWndInner(),c={id:"fc_peer"+e,marginFixedToLayer:!0,peer:e,movable:geByClass1("fc_tab_head",r),closer:geByClass1("fc_tab_close_wrap",r,"a"),resizeableH:n.logWrap,startHeight:250,startWidth:270,fixed:i.fixed,minH:150,minW:270,nofocus:!0,onFocus:function(t){n.auto&&(FastChat.stateChange({op:"added",peer:e}),delete n.auto),FastChat.restoreDraft(e),n.editable?Emoji.editableFocus(n.txt,!1,!0):elfocus(n.txt),n.wrap.clientWidth&&setStyle(n.title,{maxWidth:n.wrap.clientWidth-71}),n.editable||setStyle(n.txt.autosize.helper,{width:getStyle(n.txt,"width",!1)}),n.scroll&&n.scroll.update(!1,!0),setTimeout(elfocus.pbind(n.txt),10)},onHide:function(){i.fixed&&FastChat.hideChatCtrl(),curFastChat.activeBox&&e==curFastChat.activeBox.options.peer&&FastChat.setActive(!1)},onClose:function(t){AudioMessagePlayer.loaded&&AudioMessagePlayer.detachPlayer(),this.onHide(),i&&i.beforeClose&&i.beforeClose();var a=curFastChat.tabs,o=a[e].posSeq;if(delete a[e],curNotifier.isIdle||FastChat.stateChange({op:"hidden",peer:e}),o){var r,n,s,c,l,_={},d=[];for(each(a,(function(){this.posSeq>o&&(_[this.posSeq]=this,d.push(this.posSeq))})),d.unshift(o),d.sort(),l=!browser.msie&&d.length<10,r=1;r<d.length;r++)n=d[r],s=_[n].box,c=r>1?_[d[r-1]].box.pos:t,l?animate(s.wrap,{left:c[1]},100,function(e){e._update_pos()}.pbind(s)):setStyle(s.wrap,{left:c[1]});if(!l)for(r=1;r<d.length;r++)(s=_[d[r]].box)._update_pos()}},onMinimize:function(t){FastChat.stateChange({op:"minimized",peer:e,val:t}),FastChat.fixResized(n,n.wrap.clientWidth,!0),t||(n.txt.blur(),FastChat.restoreDraft(e))},onResizeEnd:function(t,i){var a=getWndInner(),o=n.box.pos;n.scroll&&n.scroll.show(),FastChat.fixResized(n,i,!0),FastChat.stateChange({op:"resized",peer:e,h:t/a[0],w:i/a[1],y:n.box.toBottom?-1:o[0]/a[0],x:n.box.toRight?-1:o[1]/a[1]})},onResize:function(e,t){FastChat.fixResized(n,t);var i=geByClass1("fc_tab_title",n.box.content);setStyle(i,{width:t-78})},onResizeStart:function(){delete n.posSeq,n.scroll&&n.scroll.hide(),val(n.notify,""),clearTimeout(n.hideNotifyTO)},onDragEnd:function(t,i){delete n.posSeq,FastChat.stateChange({op:"moved",peer:e,y:t,x:i})}};if(i&&extend(c,i),void 0===c.startLeft&&void 0===c.startRight){var l=[],_=s[0]-350,d=curFastChat.clistBox.pos,u=!1;if(window.Call&&(Call.box||Call.invitation)){var f=Call.calcBoxPos();l.push([f.x,f.x+f.w]),u=!0}d[0]+d[2]>_&&(curFastChat.clistBox.visible||!u)&&l.push([d[1],d[1]+d[3]]),each(curFastChat.tabs,(function(t){(d=this.box&&this.box.pos)&&t!=e&&d[0]+d[2]>_&&l.push([d[1],d[1]+d[3]])}));var h,p,v,g=lastWindowWidth-262-(0,a.sbWidth)(),m=!1,C=!1,w=0>g?1:-1;for(h=g;w*h<0*w;h+=135*w){for(p=0,v=0;v<l.length;v++)h>l[v][0]-260&&h<l[v][1]&&p++,h>l[v][0]-10&&h<l[v][0]+10&&(p+=1.1);(!1===m||p<C)&&(m=h,C=p)}u&&C&&(m=g),extend(c,{startBottom:0,startLeft:m})}var E,y=!0;for(E in i||{})if("nofocus"!=E){y=!1;break}y&&(n.posSeq=++curFastChat.posSeq),c.fixed&&(c.startHeight=curFastChat.clistH,c.startWidth=curFastChat.clistW,c.onShow=FastChat.showChatCtrl),n.box=new RBox(r,c),n.iman=new b.default({id:"tab"+e,element:n.box.content,onUnIdleCb:function(){FastChat.readLastMessages(e)},parentManager:curNotifier.idle_manager,idleTimeout:1e4}),curFastChat.tabs[e].iman.start(),c.fixed&&FastChat.setActive(n.box),n.scroll=new Scrollbar(n.logWrap,{prefix:"fc_",nomargin:!0,nokeys:!0,global:!0,right:vk.rtl?"auto":1,left:vk.rtl?1:"auto",onScroll:FastChat.onScroll.pbind(n)}),c.minimized||!i||void 0===i.startLeft&&void 0===i.startTop&&void 0===i.startWidth&&void 0===i.startHeight||n.box._wnd_resize(s[0],s[1],!0),n.wrap.clientWidth&&setStyle(n.title,{maxWidth:n.wrap.clientWidth-71}),addEvent(n.txt,"keydown",this.onInputKeydown.bind(this,n)),addEvent(n.txt,"keyup",this.onInputKeyUp.bind(this,n,e)),addEvent(n.txt,"focus",this.onInputFocus.bind(this,e)),addEvent(n.log,"click",(t=>this.onLogClick(t,+e))),FastChat.restoreDraft(e),c.onPeerAdded&&c.onPeerAdded()}},onInputFocus(e){curFastChat.peer=e},onInputKeydown(e,t){if(t.ctrlKey&&t.keyCode===KEY.RETURN){var i=t.target,a=i.value;if("number"==typeof i.selectionStart&&"number"==typeof i.selectionEnd){var o=i.selectionStart;i.value=a.slice(0,o)+"\n"+a.slice(i.selectionEnd),i.selectionStart=i.selectionEnd=o+1}else if(document.selection&&document.selection.createRange){i.focus(t);var r=document.selection.createRange();r.text="\r\n",r.collapse(!1),browser.opera&&(r.moveEnd("character",0),r.moveStart("character",0)),r.select()}e.editable?this.checkEditable(e.emojiId,e.txt):(e.txt.autosize.update(),setTimeout((()=>e.txt.autosize.update()),0))}},onInputKeyUp(e,t){var i=e.lastValue||"",a=this.getInputValue(e.txt);a.length===i.length&&a===i||(a&&this.sendTyping(t),e.lastValue=a),clearTimeout(e.saveDraftTO),e.saveDraftTO=setTimeout(this.saveDraft.pbind(t),a.length?300:0),this.checkEditable(e.emojiId,e.txt)},onLogClick:function(e,t){if(e.target.classList.contains("_fc_call_link")){var i=this.getTab(t);if((0,g.isChatPeer)(t)){var a={peerId:t,name:i.name,tab:i.name,photo:i.photo};window.Calls.startGroupCall(t,[a],[],!1,C.CallStatSource.FAST_CHAT).then((()=>this.closeTab(t)))}else{var o={peerId:t,id:t,link:i.link,name:i.name,firstName:i.fname,lastName:i.name.split(" ")[1],sex:i.sex,photo:i.photo},r=E({},o,{canAddMembers:!0});window.Calls.call(t,!1,[r,[o]],C.CallStatSource.FAST_CHAT).then((()=>this.closeTab(t)))}}},onScroll:function(e){var t=e.scroll.obj.scrollTop,i=geByClass1("_fc_msgs_more",e.logWrap);t<200&&isVisible(i)&&i.click()},loadMore:function(e,t){var i=curFastChat.tabs[e],o=i.offset;if(i.moreLoading)return!1;i.moreLoading=!0,ajax.post("al_im.php",{act:"a_history",peer:e,offset:o,from:"fc"},{onDone:function(e){e[3]||hide(t);var a=t.parentNode,o=a.clientHeight;a.insertBefore(cf(e[0]),t.nextSibling);var r=a.clientHeight-o;r&&(i.logWrap.scrollTop+=r),i.scroll.update(),i.offset=e[2],i.moreLoading=!1,FastChat.onScroll(i)},onFail:function(){i.moreLoading=!1},showProgress:a.lockButton.pbind(t),hideProgress:a.unlockButton.pbind(t)})},sendOnResponse:function(e,t,i){if(e.version&&intval(e.version)>curFastChat.version)FastChat.updateVersion(e.version);else{var a=ge("fc_msg"+t),o=e.msg_id,r=indexOf(t,i.newmsgs);if(a){if(e.media){var n={sticker:intval(e.sticker)};FastChat.lcSend("gotMedia",{msgId:t,peer:i.box.options.peer,text:e.media,msgOpts:n}),FastChat.gotMsgMedia(i.box.options.peer,t,e.media,n)}++i.msgscount,-1!=r&&i.newmsgs.splice(r,1),a.id="fc_msg"+o,i.msgs[o]=[1,1]}}},checkEditable:function(e,t){Emoji.checkEditable(e,t,{height:52})},fixResized:function(e,t,i){e&&(e.logWrap.scrollTop=e.logWrap.scrollHeight,t>0&&setStyle(e.title,{maxWidth:t-71}),i&&(e.editable||setStyle(e.txt.autosize.helper,{width:getStyle(e.txt,"width",!1)}),e.scroll&&e.scroll.update(!1,!0)))},activateTab:function(e){var t=curFastChat.tabs[e].box;curFastChat.activeBox&&curFastChat.activeBox!=t&&curFastChat.activeBox.hide(0,!1,{noState:!0}),t.show(),t.options.fixed&&FastChat.setActive(t)},blinkTab:function(e){var t=this.getTab(e);if(!t.blinking&&curFastChat.peer!=e){t.blinking=!0,clearTimeout(t.blinkingTO);var i=t.box.wrap,a=i.className,o=Math.min(N,intval(getStyle(i,"zIndex")));setStyle(i,{zIndex:N}),removeClass(i,"rb_inactive"),t.blinkingTO=setTimeout((function(){delete t.blinking,delete t.blinkingTO,getStyle(i,"zIndex")==N&&(setStyle(i,{zIndex:o}),i.className=a)}),2e3)}},createProgress:function(e,t,i){var a=ce("span",{innerHTML:rs(vk.pr_tpl,{id:"",cls:""}),className:"fc_msg_progress",id:"fc_msg_progress"+t});return e.insertBefore(a,i),a},removeProgress:function(e){re("fc_msg_progress"+e)},send:function(e,t,i){var a=curFastChat.tabs[e],o=trim(a.editable?Emoji.editableVal(a.txt):val(a.txt)),n="";t?(n=[["sticker",t]],o=""):n=a.imMedia?a.imMedia.getMedias():[];var s=ge("fc_tab_typing"+e),c=geByClass1("page_progress_preview",a.wrap);if(c&&c.childNodes.length>0){curFastChat.sendOnUpload=e;var l=geByClass("fc_tab_log",a.wrap)[0];return FastChat.createProgress(l,e,l.lastChild),void(s.style.visibility="hidden")}if(curFastChat.sendOnUpload=!1,FastChat.removeProgress(e),s.style.visibility="visible",o||n.length){var _=(0,u.random)(),d={act:"a_send",to:e,hash:a.sendhash,msg:o,from:"fc",entrypoint:curFastChat.tabs[e].entrypoint||"fastchat_old_default",media:[],random_id:_};i&&(d.sticker_referrer=i);for(var f,h=0,p=n.length;h<p;++h)(f=n[h])&&d.media.push(f[0]+":"+f[1]);d.media=d.media.join(","),a.sending=!0,Emoji.ttHide(a.emojiId),curFastChat.tabs[e].entrypoint=!1,ajax.post("al_im.php",d,{onDone:function(t){clearTimeout(a.saveDraftTO),FastChat.saveDraft(e),FastChat.sendOnResponse(t,_,a)},onFail:function(t){FastChat.error(e,t||(0,r.getLang)("global_unknown_error")),elfocus(a.txt),val(a.txt,clean(o)),a.editable?FastChat.checkEditable(a.emojiId,a.txt):a.txt.autosize.update();var i=ge("fc_msg"+_);if(i)return i.appendChild(ce("span",{className:"fc_msg_error",innerHTML:(0,r.getLang)("global_error")})),FastChat.scroll(e),!0},showProgress:function(){a.sending=!0,a.sendProgressTO=setTimeout((function(){var e=ge("fc_msg"+_);e&&FastChat.createProgress(e,_,e.firstChild)}),2e3)},hideProgress:function(){a.sending=!1,clearTimeout(a.sendProgressTO),FastChat.removeProgress(_)}}),re("fc_error"+e),t||(val(a.txt,""),a.imMedia&&a.imMedia.unchooseMedia()),FastChat.addMessage(FastChat.prepareMessageData({messageId:_,text:clean(o).replace(/\n/g,"<br>"),peerId:e,flags:3,randomId:d.random_id,attaches:[]})),delete curFastChat.myTypingEvents[e],a.editable?FastChat.checkEditable(a.emojiId,a.txt):a.txt.autosize.update(!1,!0),elfocus(a.txt),FastChat.scroll(e),FastChat.trackActivity("send")}else a.editable?Emoji.editableFocus(a.txt,!1,!0):elfocus(a.txt)},saveDraft:function(e){var t=curFastChat.tabs[e],i=(t||{}).txt;if(i&&t){var a=Emoji.editableVal(i),o=(0,l.loadDraftForPeer)(curFastChat.ldb,e);o.setText(trim(a)||""),o.destroy()}},restoreDraft:function(e){var t=curFastChat.tabs[e],i=t.txt,a=(0,l.loadDraftForPeer)(curFastChat.ldb,e);return!(!i||!t||val(i).length>a.dData.txt.length&&!a.hasAttaches())&&(t.editable?i.innerHTML=Emoji.emojiToHTML(clean(a.dData.txt),1):val(i,clean(a.dData.txt)),setTimeout((()=>{for(var e=a.dData.attaches,i=0;i<e.length;i++)t.imMedia&&t.imMedia.chooseMedia(e[i].type,e[i].id,e[i].object||{});a.destroy()}),40),FastChat.checkEditable(t.emojiId,i),setTimeout((function(){i.scrollTop=i.scrollHeight}),10),!0)},error:function(e,t){e=e||curFastChat.peer;var i=curFastChat.tabs[e];re("fc_error"+e),i.log.appendChild(ce("div",{id:"fc_error"+e,className:"fc_msgs_error",innerHTML:t||(0,r.getLang)("global_error")})),FastChat.scroll(e)},scroll:function(e){e=e||curFastChat.peer;var t=curFastChat.tabs[e];t&&(t.logWrap.scrollTop=t.logWrap.scrollHeight,t.scroll&&t.scroll.update(!1,!0))},mkdate:function(e){var t=new Date(1e3*e),i=new Date,a=function(e){return(e+"").length<2?"0"+e:e};if(t.getDay()==i.getDay())return a(t.getHours())+":"+a(t.getMinutes());var o=a(t.getDate())+"."+a(t.getMonth()+1);return t.getFullYear()!=i.getFullYear()&&(o+="."+(t.getFullYear()+"").substr(2)),o},prepareMessageData(e){var t=e.peerId,i=e.flags,a=e.messageId,o=e.text,n=e.date,s=(0,v.getUserId)(e),c=y(this.getMessageMedia(e),2),l=c[0],_=c[1],d="",u=e.randomId;((0,v.isServiceMsg)(e)||(0,v.isCallMessage)(e))&&(d=this.renderServiceMessage(e));var f=(0,v.isServiceMsg)(e)||(0,v.isCallMessage)(e)?d:(0,v.isExpiredCasperMessage)(e)?(0,r.getLang)("mail_expired_message"):this.getMessageText(o,t)+l;return-1!==String(a).indexOf("rid")&&(u=Number(a.slice(3))),Object.assign({id:a,peer:t,from_id:s,text:f,out:(0,v.isOut)(e),unread:Boolean(1&i),date:n,date_str:FastChat.mkdate(n),randomId:u,isServiceMessage:(0,v.isServiceMsg)(e)||(0,v.isCallMessage)(e)},this.getMessageAuthor(e),_)},getMessageAuthor(e){var t=e.peerId,i=(0,v.getUserId)(e),a=this.getTab(e.peerId);if(!a||!i)return{};var o=(0,v.isOut)(e)?curFastChat.me:(0,g.isChatPeer)(t)?a.data.members[i]:a,r=o.name,n=o.link,s=o.photo,c=o.fname,l=o.first_name;return{fname:(0,g.isChatPeer)(t)?c||l:"",from_id:i,name:r,link:n,photo:s}},getMessageMedia(e){var t=e.peerId,i=e.messageId;if((0,v.isServiceMsg)(e)||(0,v.isCallMessage)(e)||!Array.isArray(e.attaches))return["",{}];var a="",o={};return e.attaches.forEach((e=>{switch(e.type){case"sticker":a+=i?this.renderSticker(e.id,e.productId,e.kind,i):this.renderSticker(e.id,e.productId),o.sticker=!0;break;case"mail":var n=e.object?e.object.fwd_count:e.id.split(";").length;a+=rs(curFastChat.tpl.msg_fwd,{msg_id:i,peerId_nice:(0,g.convertPeerToUrl)(t),label:(0,r.getLang)(n>1?"mail_im_fwd_msgs":"mail_im_fwd_msg")});break;default:a+=rs(vk.pr_tpl,{id:"",cls:""}),i>0&&setTimeout(FastChat.needMsgMedia.pbind(t,i),5)}})),a&&(a=`<div class="fc_msg_attachments" id="fc_msg_attachments${i}">${a}</div>`),[a,o]},renderSticker(e,t,i,a){var o,r=window.devicePixelRatio>=2?"256":"128";return"animation"===i?(o=rs(curFastChat.tpl.animatedSticker,{id:e,size:r,productId:t,messageId:a}),Number.isInteger(a)&&this.loadStickersModuleIfNeed().then((()=>{window.StickersSettings.getAutoplay()&&window.StickersAnimation&&window.StickersAnimation.loadAndPlayStickerWithTimer("animatedSticker"+a,10)}))):o=rs(curFastChat.tpl.sticker,{id:e,size:r}),o},loadStickersModuleIfNeed:()=>new Promise((e=>{var t=Boolean(window.StickersSettings&&window.StickersAnimation);curFastChat.stickersLoading||t?e():(curFastChat.stickersLoading=!0,stManager.add([jsc("web/stickers.js")],(()=>{curFastChat.stickersLoading=!1,e()})))})),renderServiceMessage(e){if((0,v.isCallMessage)(e))return this.renderCallMessage(e);var t=e.kludges,i=e.peerId,a=t.source_act,o=Number(t.source_mid),n=intval((0,g.isChatPeer)(e.peerId)?t.from:e.userId),s=this.getMember(i,n),c="",l=n===o;switch(a){case g.CREATE_CHAT_ACTION:c="mail_im_chat_created";break;case g.CHAT_TITLE_ACTION:c=t.source_is_channel?"mail_im_title_updated_channel":"mail_im_title_updated_dot";break;case g.CHAT_INVITE_USER:c=l?"mail_im_returned_to_chat":"mail_im_invited";break;case g.CHAT_KICK_USER:c=l?"mail_im_left":"mail_im_kicked_from_chat";break;case g.CHAT_PHOTO_UPDATE:c="mail_im_photo_set";break;case g.CHAT_PHOTO_REMOVE:c=t.source_is_channel?"mail_im_photo_removed_channel":"mail_im_photo_removed";break;case g.CHAT_PIN_MESSAGE:c=t.source_message?"mail_im_pin_message":"mail_im_pin_message_empty2";break;case g.CHAT_UNPIN_MESSAGE:c=t.source_message?"mail_im_unpin_message":"mail_im_unpin_message_empty2";break;case g.CHAT_INVITE_BY_LINK:c="mail_im_invite_by_link";break;case g.CHAT_SCREENSHOT:c=vk.id===o?"mail_im_chat_own_screenshot":"mail_im_chat_screenshot";break;case g.CHAT_GROUP_CALL_STARTED:c="mail_im_group_call_started";break;case g.CHAT_KICK_USER_CALL_BLOCK:c="mail_im_kick_user_call_block";break;case g.CHAT_KICK_DON:c="mail_im_chat_kick_don";break;default:return"mail_no_support"}if(c=(c=langSex(s.sex,(0,r.getLang)(c,"raw"))).replace("{from}",(0,w.getServiceLinkTemplate)(s.link,s.name,!0)),o&&o!==n){var _=t.source_email;if(_)c=c.replace("{user}",(0,w.getServiceLinkTemplate)(`/im?email=${encodeURIComponent(_)}`,"email",!0));else{var d=this.getMember(i,o)||{name_inv_case:"",name_kick_case:"",link:""},u=a===g.CHAT_KICK_USER?d.name_kick_case:d.name_inv_case;c=c.replace("{user}",(0,w.getServiceLinkTemplate)(d.link,u,!0))}}if(t.source_text){var f=t.source_old_text?`«<b class="im_srv_lnk">${t.source_old_text}</b>» &rarr; `:"";c=c.replace("{title}",f+`«<b class="im_srv_lnk">${t.source_text}</b>»`)}if(t.source_act===g.CHAT_PIN_MESSAGE||t.source_act===g.CHAT_UNPIN_MESSAGE)if(t.source_message){var h=(0,g.replaceSpecialSymbols)(Emoji.emojiToHTML(stripHTML(t.source_message.replace(/<br\s?\/?>/gi," ")),!0)),p=(0,w.getServiceLinkTemplate)("",h,!1,"im_srv_mess_link");c=c.replace("{msg}",p)}else c=c.replace(/{link}(.+){\/link}/i,((e,t)=>(0,w.getServiceLinkTemplate)("",t,!1,"im_srv_mess_link")));return c},renderCallMessage(e){var t,i=vk.id,a=e.attaches[0],o=a.initiatorId,n=a.state,s=a.receiverId,c=i===o;switch(n){case"reached":var l=(0,g.secondsToHuman)(a.duration);t=(t=c?(0,r.getLang)("mail_call_outgoing"):(0,r.getLang)("mail_call_incoming")).replace("{duration}",l);break;case"canceled_by_initiator":t=c?(0,r.getLang)("mail_call_canceled"):(0,r.getLang)("mail_call_missed");break;case"canceled_by_receiver":if(c){var _=S(curFastChat.friends[s+"_"],s);t=_?langSex(_.sex,(0,r.getLang)("mail_call_declined_by","raw")).replace("{user_name}",_.name):(0,r.getLang)("mail_call_declined")}else t=(0,r.getLang)("mail_call_canceled");break;default:t=(0,r.getLang)("mail_added_call")}return getTemplate("im_calls_link",{text:t,peerId:e.peerId})},getMember(e,t){var i=this.getTab(e);return(0,g.isChatPeer)(e)&&i?i.data.members[t]:i||null},needMsgMedia:function(e,t){t<=0||(FastChat.lcSend("needMedia",{msgId:t}),curFastChat.needMedia[t]=[e,setTimeout(FastChat.loadMsgMedia.pbind(e,t),curNotifier.is_server?0:irand(150,250))])},loadMsgMedia:function(e,t){t<=0||void 0!==curFastChat.gotMedia[t]&&0!==curFastChat.gotMedia[t]||(FastChat.lcSend("fetchingMedia",{msgId:t}),curFastChat.gotMedia[t]=0,ajax.post("al_im.php",{act:"a_get_media",id:t,from:"fc"},{onDone:function(i){var a=y(i,4),o=(a[0],a[1]),r=(a[2],a[3]);FastChat.lcSend("gotMedia",{msgId:t,peer:e,text:o,msgOpts:r}),FastChat.gotMsgMedia(e,t,o,r)}}))},gotMsgMedia:function(e,t,i,a){if(val("fc_msg_attachments"+t,i),a&&a.sticker){var o=ge("fc_msg"+t),r=o&&o.parentNode;o&&addClass(r.parentNode,"fc_msg_sticker"),window.StickersAnimation&&window.StickersAnimation.checkSettingsAndLoadInWeb(t,!1,!1,!0)}FastChat.scroll(e),curFastChat.gotMedia[t]=[e,i,a],a&&a.stickers&&window.Emoji&&Emoji.updateTabs(a.stickers,a.keywords),void 0!==curFastChat.needMedia[t]&&(clearTimeout(curFastChat.needMedia[t][1]),delete curFastChat.needMedia[t])},replaceSpecialSymbols:function(e){return e.replace(/&lt;&lt;/g,"&laquo;").replace(/&gt;&gt;/g,"&raquo;").replace(/ \-\-/g," &mdash;").replace(/\-\- /g,"&mdash; ").replace(/(^|[\s.,:\'\";>\)\(])(\*|@)([A-Za-z0-9_\.]{2,32})\s*\((.+?)\)/g,"$1$4")},addMessage:function(e){var t,i=e.peer,a=this.getTab(i),o=a.log;if(!a||e.out||!a.box.visible||a.iman.is_idle||curNotifier.idle_manager.is_idle||(e.unread=!1,FastChat.markRead(e.peer,[e.id])),e.randomId&&re(document.querySelector(`[data-random-id="${e.randomId}"]`)),a.msgs[e.id]=[e.out,e.unread],this.isNewStack(e)){re("fc_log_empty"+i);var n=(e.out?"fc_msgs_out ":"")+(e.unread?"fc_msgs_unread":"");e.sticker&&(n+=" fc_msg_sticker");var s=e.isServiceMessage?curFastChat.tpl.msgs_service:e.out?curFastChat.tpl.msgs_out:curFastChat.tpl.msgs;t=se(rs(s,{from_id:e.from_id,link:e.link,photo:Notifier.fixPhoto(e.photo),name:e.from_id==curFastChat.me.id?(0,r.getLang)("mail_im_thats_u"):stripHTML(e.name),classname:n,date:e.date,date_str:e.date_str,msgs:"",randomId:e.randomId||0,messageId:e.id})),o.appendChild(t)}else e.unread||removeClass(t,"fc_msgs_unread");var c=geByClass1("fc_msgs_list",t,"div"),l=geByClass1("fc_msgs_date",c),_=geByClass1("fc_msg_last",c);_&&removeClass(_,"fc_msg_last");var d=FastChat.replaceSpecialSymbols(e.text),u=se(rs(curFastChat.tpl.msg,{msg_id:e.id,classname:(e.unread?"fc_msg_unread":"")+" fc_msg_last",text:e.isServiceMessage?`<div class="fc_srv_msg">${d}</div>`:d}));domFC(c)&&"BR"===domFC(c).tagName&&re(domFC(c)),l?c.insertBefore(u,l):c.appendChild(u),vk.id!=e.from_id&&(delete curFastChat.typingEvents[i],FastChat.updateTyping(i,1)),a.scroll&&a.scroll.update()},getTab:e=>curFastChat.tabs[e],isTabLoaded(e){return Boolean(curFastChat.tabs&&this.getTab(e))},isNewStack(e){var t=this.getTab(e.peer).log.lastChild;return t&&"fc_msgs_error"==t.className&&(t=t.previousSibling),!t||(!hasClass(t,"fc_msgs_wrap")||(!hasClass(t,"fc_msgs_unread")&&!0===e.unread||(t.getAttribute("data-from")!==e.from_id||(e.date-intval(t.getAttribute("data-date"))>=300||!(!e.sticker&&!hasClass(t,"fc_msg_sticker"))))))},editMessage(e){var t=e.id,i=ge("fc_msg"+t);if(i){var a=se(rs(curFastChat.tpl.msg,{msg_id:t,classname:i.getAttribute("class"),text:FastChat.replaceSpecialSymbols(e.text)}));i.parentNode.replaceChild(a,i)}},deleteMessage(e){var t=e.id,i=ge("fc_msg"+t);if(i){var a=!domNS(i)&&!domPS(i),o=domClosest("fc_tab_log_msgs",i);for(re(a?domClosest("fc_msgs_wrap",i):i);hasClass(domLC(o),"fc_msgs_date");)re(domLC(o))}},updateTabUnreadCounter(e,t){if(!e){var i=document.querySelector(`#chat_tab_icon_${t.peerId}`),a=i&&i.querySelector(".chat_tab_counter");e={unread:a&&Math.max(+a.innerHTML,0)||0}}(0,v.isOut)(t)?e.unread=0:e.unread++,this.updateTabUnreadCounterElement(e,t.peerId)},updateTabUnreadCounterElement(e,t){if(e){var i=document.querySelector(`#chat_tab_icon_${t}`),a=i&&i.querySelector(".chat_tab_counter");a&&(a.innerHTML=e.unread>0?e.unread:""),e.title&&e.name&&(val(e.title,e.name+(e.unread?' <span class="fc_tab_count">('+e.unread+")</span>":"")),val("fc_contact_unread"+t,e.unread?" <b>+"+e.unread+"</b>":""))}},showMsgFwd:function(e){return!showBox("al_im.php",{act:"a_show_forward_box",id:vk.id+"_"+e,from:"mail"},{stat:["im.css"],dark:1,params:{onHide:function(){AudioMessagePlayer.loaded&&AudioMessagePlayer.detachPlayer(!0)}}})},closeTab:function(e){curFastChat.tabs[e].box.close()},trackActivity(e){(0,p.statlogsValueEvent)("im_fastchat_location",e,window.cur.module)},toggleFastChats(e){var t=!e;toggleClass(ge("chat_onl_wrap"),"fast_chats_toggle_hide",t),toggleClass(ge("rb_box_fc_clist"),"fast_chats_toggle_hide",t),each(geByClass("rb_box_wrap"),(()=>toggleClass(this,"fast_chats_toggle_hide",t)))},toggleFullScreenState(e){e?document.body.classList.add(F):document.body.classList.remove(F)},getFullScreenState:()=>document.body.classList.contains(F),tplBox:'<div class="fc_tab_wrap"><div class="fc_tab_head clear_fix"><a class="fc_tab_close_wrap"><div class="chats_sp fc_tab_close"></div></a><a class="fc_tab_max_wrap" href="/im?sel=%id%" onmousedown="event.cancelBubble = true;" onclick="return nav.go(this, event);"><div class="chats_sp fc_tab_max"></div></a><a class="fc_tab_pin_wrap" onmousedown="event.cancelBubble = true;" onclick="return FastChat.pinTab(%id%, event);"><div class="chats_sp fc_tab_pin"></div></a><div class="fc_tab_title noselect">%name%</div></div><div class="fc_tab"><div class="fc_tab_log_wrap"><div class="fc_tab_notify_wrap"></div><div class="fc_tab_log"><div class="fc_tab_log_msgs"></div><div class="fc_tab_typing" id="fc_tab_typing%id%"><div class="pr fc_tab_typing_icon _fc_tab_typing_progress" id=""><div class="pr_bt"></div><div class="pr_bt"></div><div class="pr_bt"></div></div><div class="fc_tab_typing_name _fc_tab_typing_name"></div></div></div></div><div class="fc_tab_txt_wrap"><a class="fc_tab_attach"></a><div class="fc_tab_txt">%cont%<div class="fc_tab_preview"></div></div></div></div><div class="fc_pointer_offset"><div class="fc_tab_pointer fc_tab_pointer_peer"></div></div></div>',tplTab:'<div class="fc_tab_log_wrap"><div class="fc_tab_notify_wrap"></div><div class="fc_tab_log"><div class="fc_tab_log_msgs"></div><div class="fc_tab_typing" id="fc_tab_typing%id%"><div class="pr fc_tab_typing_icon _fc_tab_typing_progress" id=""><div class="pr_bt"></div><div class="pr_bt"></div><div class="pr_bt"></div></div><div class="fc_tab_typing_name _fc_tab_typing_name"></div></div></div></div><div class="fc_tab_txt_wrap"><div class="fc_tab_txt">%cont%</div></div>'}},367537:(__unused_webpack___webpack_module__,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(175115),core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(21466),core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(59357),core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(940851),core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(296253),core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(751876),_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(787481),_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(376270),_shared_lib_idle_manager__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(588379),_shared_lib_convert__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(668040),_shared_lib_common__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(40906),_longpoll_singleton__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(316031),_web_components_im_ServerSentEvents_DEPRECATEDLongpollAdapter__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(734693),_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(19331),_shared_lib_site__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(961540),_web_lib_feature_entries__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(850167),_shared_audio_utils_wrapAudioPlay__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(602227),_web_lib_message_box__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(654612),_web_market_HappySanta__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(597332),_shared_im_request__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(887294),_shared_im_EventQueue__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(967181),_shared_helpers_html_entities__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(449849),_shared_im_longpoll_events__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(663825),_web_messenger_helpers_events__WEBPACK_IMPORTED_MODULE_23__=__webpack_require__(645523),_shared_lib_js_logger__WEBPACK_IMPORTED_MODULE_24__=__webpack_require__(66433),_notifier_utils__WEBPACK_IMPORTED_MODULE_26__=__webpack_require__(16850),_vkontakte_internal_calls_constants__WEBPACK_IMPORTED_MODULE_25__=__webpack_require__(173674);function _extends(){return _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},_extends.apply(this,arguments)}var ACTIVE_TAB_SWITCH_SERVER_TIMEOUT=browser.safari?3e3:1e4,LC_SERVER_SWITCH_TO_ACTIVE_FLAG="lc_server_switch_to_active_flag",NOTIFICATION_FADE_TIMEOUT=7e3,NOTIFICATION_FADE_TIMEOUT_ACCESSIBILITY_MODE=35e3,NOTIFICATION_FADE_TIMEOUT_AFTER_UNFREEZE=5e3,NOTIFICATION_FADE_TIMEOUT_ACCESSIBILITY_MODE_AFTER_UNFREEZE=3e4,IS_SSE_ENABLED=(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_sse_longpoll"),isMediaStoppedByCalls=!1,errorTimeout={initialValue:1,get:()=>window.curNotifier.error_timeout||errorTimeout.initialValue,set:e=>{window.curNotifier.error_timeout=e},reset:()=>{window.curNotifier.error_timeout=errorTimeout.initialValue},increase:()=>{window.curNotifier.error_timeout<64&&(window.curNotifier.error_timeout*=2)},increaseMore:()=>{window.curNotifier.error_timeout<256&&(window.curNotifier.error_timeout*=2)},decrease:()=>{window.curNotifier.error_timeout=Math.max(1,errorTimeout.get()/1.5)}};function showEventThumb(e){var t="",i="";if(e.author_photo){var a;t="video_process_ready"===e.type?`<div class="notifier_video_thumb" style="background-image: url('${Notifier.fixPhoto(e.author_photo)}')"></div>`:`<img alt="" src="${Notifier.fixPhoto(e.author_photo)}" class="notifier_image" />`;var o=null===(a=e.icon_custom)||void 0===a?void 0:a.image_url;o?t=`<div class="feedback_photo_icon_custom" style="background-image: url('${(0,_shared_helpers_html_entities__WEBPACK_IMPORTED_MODULE_21__.escape)(o)}')"></div>`+t:e.icon_type&&(t='<div class="feedback_photo_icon"></div>'+t,i=` feedback_${e.icon_type}_row`),e.author_link&&(t=`<a href="${e.author_link}">${t}</a>`),t=`<div class="notifier_image_wrap${i}">${t}</div>`}return t}function showEventAddPhoto(e){var t="";return e.add_photo&&(t=`<div class="notifier_add_image_wrap"><img src="${e.add_photo}" class="notifier_add_image"></div>`),t}function setHooksForLoadingCalls(e){var t;if(!1!==(null===(t=window.Calls)||void 0===t?void 0:t.initialized)){var i={},a=t=>function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return loadCallsModule().then((()=>{var t,i;return null===(t=window.Calls)||void 0===t||null===(i=t.init)||void 0===i?void 0:i.call(t,e)})).then((()=>{var e,i;return null===(e=(i=window.Calls)[t])||void 0===e?void 0:e.call(i,...a)}))};i.call=a("call"),i.startGroupCall=a("startGroupCall"),i.startCall=a("startCall"),i.acceptCall=a("acceptCall"),i.joinCallByLink=a("joinCallByLink"),i.showJoinPopup=a("showJoinPopup"),i.showCallByNamePopup=a("showCallByNamePopup"),i.showCreateCallByLinkPopup=a("showCreateCallByLinkPopup"),i.showStartCallModal=a("showStartCallModal"),i.showHistoryScreen=a("showHistoryScreen"),i.initArgs=e,window.Calls=i;var o=window.Notifier.getLpInstance();o&&o.onData((function t(){var i;if(null===(i=window.Calls)||void 0===i?void 0:i.initialized)o.offData(t);else{for(var a=arguments.length,r=new Array(a),n=0;n<a;n++)r[n]=arguments[n];r.forEach((i=>{if(i.type===_vkontakte_internal_calls_constants__WEBPACK_IMPORTED_MODULE_25__.INCOMING_CALL)return o.offData(t),loadCallsModule().then((()=>{var t;return null===(t=window.Calls)||void 0===t?void 0:t.init(e)})).then((()=>window.Calls.handleEvent(i)))}))}}))}else window.Calls.init(e)}function loadVKUIModule(){return new Promise((e=>stManager.add(["vkui.css"],(()=>e()))))}function loadCallsModule(){return new Promise((e=>{stManager.add([jsc("web/calls.js"),"vkui.css","calls.css"],(()=>{e()}))}))}function loadReforgedFastchatModule(){var e=ls.get("stickers_keywords"),t=e&&e.time?Math.floor(e.time/1e3):0;return ajax.post("al_im.php",{act:"a_get_fast_chat",cache_time:t},{onDone:e=>{e.emoji_stickers&&(window.emojiStickers=e.emoji_stickers),window.Emoji&&Emoji.updateTabs(),e.autoplay_animations&&window.StickersSettings.setAutoplay(e.autoplay_animations)},onFail:()=>!0}),window.stManager.add([window.jsc("web/ui_media_selector.js"),"vkui.css","ui_media_selector.css",window.jsc("web/emoji.js")]).then((()=>Promise.all([__webpack_require__.e(38288),__webpack_require__.e(40885),__webpack_require__.e(68592),__webpack_require__.e(58042),__webpack_require__.e(11700)]).then(__webpack_require__.bind(__webpack_require__,869210))))}window.curNotifier||(window.curNotifier={addQueues:{},recvClbks:{},recvData:{},onConnectionId:[]}),window.Notifier={debug:!1,init:function(e){var t;if(!window.curNotifier||!curNotifier.connection_id){if(Notifier.notificationsGc(),window.curNotifier=_extends({},e,{q_events:[],q_prior_events:[],q_shown:[],q_closed:[],q_max:3,q_idle_max:5,negotiations:{},currentIm:{},uiNotifications:[],browser_shown:{},done_events:{},addQueues:curNotifier.addQueues||{},recvClbks:curNotifier.recvClbks||{},recvData:curNotifier.recvData||{},error_timeout:errorTimeout.initialValue,request_timeout:1e3,sound:new Sound("mp3/bb1"),sound_im:new Sound("mp3/bb2"),sound_im_current:new Sound("mp3/bb3"),onConnectionId:[],showDoneBoxLastId:-1}),!this.initFrameTransport())return!1;this.initIdleMan(),this.initCommunityQueues(),IS_SSE_ENABLED||(0,_longpoll_singleton__WEBPACK_IMPORTED_MODULE_11__.lpSingletonOnTabInitialLoaded)(),(curNotifier.cont=ge("notifiers_wrap"))||bodyNode.insertBefore(curNotifier.cont=ce("div",{id:"notifiers_wrap",className:"fixed"}),ge("page_wrap"));if(loadVKUIModule(),!(null===(t=window.Calls)||void 0===t?void 0:t.initialized)&&!e.callsIsForbidden){var i,a={callsCredentials:e.callsCredentials,imHash:e.imHash,participantLimit:e.participantLimit,callsOkStaging:e.callsOkStaging,pushToTalkEnabled:e.callsPushToTalkEnabled,toggles:{debugLog:e.callsLogging,incomingCall:e.CallsIncomingCall,allowBanParticipant:e.callsAllowBanParticipant,showFeedbackScreen:e.callsFeedbackScreenEnabled,enableVideoSlots:e.callsVideoSlotsEnabled,videoSlotsCount:e.videoSlotsCount,browserWarnings:e.browserWarnings,allowCallByName:e.callsAllowCallByName,enableScreenTrack:e.callsEnableScreenTrack,enableProducerScreenTrack:e.callsEnableProducerScreenTrack,allowWaitingHall:e.callsAllowWaitingHall,allowPushToTalk:e.callsAllowPushToTalk,badNetwork:e.callsBadNetwork,badNetworkP2P:e.callsBadNetworkP2P,desktopAppNotification:e.callsDesktopAppNotification,enableVirtualBackground:e.callsEnableVirtualBackground,statReports:e.callsStatReports,lazyLoading:e.callsLazyLoading,enableDomainBender:e.callsEnableDomainBender,enableMultipleDevices:e.callsEnableMultipleDevices},onError:e=>{var t=e.msg;return t&&(0,_shared_lib_js_logger__WEBPACK_IMPORTED_MODULE_24__.logError)(t),t&&(0,_web_lib_message_box__WEBPACK_IMPORTED_MODULE_17__.showFastBox)(getLang("global_error"),t)},onBeforeCallStart:()=>{Notifier.pauseGlobalMedia()},onAfterCallFinish:()=>{Notifier.resumeGlobalMedia()},tabIsMaster:()=>Notifier.tabIsMaster(),isFriend:e=>!!(window.curFastChat&&window.curFastChat.friends&&window.curFastChat.friends[e+"_"])},o=/(firefox)\/(\d+)\.(\d+)/.test(navigator.userAgent.toLowerCase());if(e.callsLazyLoading&&!o)setHooksForLoadingCalls(a);else window.Calls=null!==(i=window.Calls)&&void 0!==i?i:{},window.Calls.initArgs=a,window.requestIdleCallback((()=>{loadCallsModule().then((()=>{var e,t;null===(e=window.Calls)||void 0===e||null===(t=e.init)||void 0===t||t.call(e,a)}))}))}if((0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_longpoll_unread_counter")){var r=Notifier.getLpInstance();r&&r.onData(Notifier.handleUnreadCountChange)}}},handleUnreadCountChange(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];(0,_web_messenger_helpers_events__WEBPACK_IMPORTED_MODULE_23__.compactCounterEvents)(t).forEach((e=>{if(e.type===_shared_im_longpoll_events__WEBPACK_IMPORTED_MODULE_22__.UNREAD_COUNT){var t=e.showOnlyNotMuted,i=e.countNotMuted,a=e.count,o=e.headerNotMutedUnread;handlePageCount("msg",t?i:a,"","",i>0,o)}}))},initCommunityQueues:function(e){var t=ls.get("im_m_comms_key"),i=t&&t.split?t.split(";"):[];if("empty"===i[0]&&i[1]&&Date.now()-i[1]<6e4?t="empty":"empty"===i[0]&&(t=!1),t)return Notifier.proccessCommunityQueues(t,e||0);ajax.post("al_im.php",{act:"a_get_comms_key"},{onDone:function(t){"empty"===t?t+=";"+Date.now():Notifier.proccessCommunityQueues(t,e||0),ls.set("im_m_comms_key",t)},onFail:function(){return!0}})},notificationsGc:function(){curNotifier.uiGcTo=setTimeout((function(){for(var e=curNotifier.uiNotifications,t=[],i=0;i<e.length;i++){var a=e[i];Date.now()-a[1]>1e4?a[0].close():t.push(a)}curNotifier.uiNotifications=t,Notifier.notificationsGc()}),5e3)},resetCommConnection:function(e){var t=ls.get("im_m_comms_key");t&&delete curNotifier.addQueues[t.queue],ls.set("im_m_comms_key",!1),Notifier.initCommunityQueues(e||0)},proccessCommunityQueues:function(e,t){if("empty"===e||!e)return!1;Notifier.addKey(e,(function(e,i){if(i.failed)++t<50&&setTimeout(Notifier.resetCommConnection.pbind(t),100);else{(e=ls.get("im_m_comms_key"))&&(e.ts=i.ts,ls.set("im_m_comms_key",e));var a=i.events;a&&a.map((function(e){return e.split("<!>")})).forEach((function(e){if("update_cnt"===e[1]){var t=e[5],i=e[4];handlePageCount("mgid"+t,i)}}))}}))},destroy:function(){if(Notifier.hideAllEvents(),curNotifier.idle_manager.stop(),curNotifier.uiGcTo&&clearTimeout(curNotifier.uiGcTo),curNotifier={},re("notifiers_wrap"),re("queue_transport_wrap"),(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_longpoll_unread_counter")){var e=Notifier.getLpInstance();e&&e.offData(Notifier.handleUnreadCountChange)}},reinit:function(){ajax.post("notifier.php?act=a_get_params",{},{onDone:function(e){e?(errorTimeout.reset(),this.init(e)):(setTimeout(this.reinit.bind(this),1e3*errorTimeout.get()),errorTimeout.increaseMore())}.bind(this),onFail:function(){return setTimeout(this.reinit.bind(this),1e3*errorTimeout.get()),errorTimeout.increaseMore(),!0}.bind(this)})},standby:function(e){this.destroy(),e&&errorTimeout.set(e),setTimeout(this.reinit.bind(this),1e3*errorTimeout.get())},freezeEvents:function(){curNotifier.frozen=!0,curNotifier.unfreezeAfterTooltipHide=!1,each(curNotifier.q_shown,(function(){clearTimeout(this.fadeTO),getStyle(this.baloonEl,"opacity")<1&&animate(this.baloonEl,{opacity:1},100)}))},unfreezeEvents:function(){curNotifier.tooltipShown?curNotifier.unfreezeAfterTooltipHide=!0:(curNotifier.frozen=!1,each(curNotifier.q_shown,(function(e,t){t.timeoutConf?t.fadeTO=setTimeout(t.startFading,(0,_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__.hasAccessibilityMode)()?t.timeoutConf.unfreeze_am:t.timeoutConf.unfreeze):t.fadeTO=setTimeout(t.startFading,(0,_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__.hasAccessibilityMode)()?3e4:5e3)})))},getTransportWrap:function(){return ge("queue_transport_wrap")||utilsNode.appendChild(ce("div",{id:"queue_transport_wrap"}))},setFocus:function(e){var t=(e?"1":"0")+curNotifier.instance_id;"frame"===curNotifier.transport&&(Notifier.lcSend("focus",{instance_id:t}),this.onInstanceFocus(t))},initIdleMan:function(){curNotifier.idle_manager&&curNotifier.idle_manager.started||(curNotifier.idle_manager=new _shared_lib_idle_manager__WEBPACK_IMPORTED_MODULE_8__.default({onIdleCb:function(){Notifier.freezeEvents(),Notifier.setFocus(0),cur.onIdle&&each(cur.onIdle,(function(e,t){t()}))},onUnIdleCb:function(){Notifier.unfreezeEvents(),Notifier.setFocus(1),cur.onUnidle&&each(cur.onUnidle,(function(e,t){t()})),FastChat&&FastChat.onUnidle(),vk.spentLastSendTS=Date.now()},id:"window",element:document,focusElement:window}),curNotifier.idle_manager.start())},initFrameTransport:function(){if(!ls.checkVersion()||browser.msie8||!("onmessage"in window)&&!("postMessage"in window))return!1;for(var e in curNotifier.connection_id="queue_connection_"+curNotifier.queue_id,curNotifier.lc_prev_value="",curNotifier.is_server=!1,curNotifier.lp_connected=!1,curNotifier.transport="frame",errorTimeout.reset(),this.lcInit(),curNotifier.onConnectionId)curNotifier.onConnectionId[e]();return curNotifier.onConnectionId=[],!0},tabIsMaster:function(){return!(!window.curNotifier||!window.curNotifier.is_server)},tabIsIdle:function(){return!!(curNotifier&&curNotifier.idle_manager&&curNotifier.idle_manager.is_idle)},onActivated:function(){curNotifier.idle_manager&&curNotifier.idle_manager.is_idle?curNotifier.idle_manager.is_idle=!1:curNotifier.idle_manager&&curNotifier.idle_manager.is_idle||Notifier.setFocus(1),removeEvent(document,"mousemove keydown touchstart",Notifier.onActivated)},onConnectionInit:function(){addEvent(document,"mousemove keydown touchstart",Notifier.onActivated)},onConnectionFailed:function(){},onRelogin:function(){setTimeout((function(){Notifier.standby()}),0)},onMessage:function onMessage(msg){if(!curNotifier.focus_instance||curNotifier.focus_instance==curNotifier.instance_id)try{var events=eval("("+msg+")");Notifier.pushEvents(events)}catch(e){debugLog(e.message)}},onInstanceFocus:function(e){var t=e.charAt(0);e=e.substr(1),"1"==t?(curNotifier.focus_instance=e,e!=curNotifier.instance_id&&(curNotifier.idle_manager.is_idle||curNotifier.idle_manager.idle(),Notifier.hideAllEvents())):curNotifier.focus_instance==e&&(curNotifier.focus_instance="")},onInstanceServer:function(e){curNotifier.is_server!==!!e&&(curNotifier.is_server=!!e,IS_SSE_ENABLED||(0,_longpoll_singleton__WEBPACK_IMPORTED_MODULE_11__.lpSingletonSyncWithNotifier)(),window.reforgedME&&window.reforgedME.engine&&window.reforgedME.engine.switch(e?"master":"slave"))},getLpInstance:()=>IS_SSE_ENABLED?(window.sseConnect||(window.sseConnect=new _web_components_im_ServerSentEvents_DEPRECATEDLongpollAdapter__WEBPACK_IMPORTED_MODULE_12__.DEPRECATEDLongpollAdapter(window.vk.lpConfig.key,window.vk.lpConfig.ts,window.vk.lpConfig.sseUrl,window.vk.id)),window.sseConnect):(0,_longpoll_singleton__WEBPACK_IMPORTED_MODULE_11__.lpSingletonGetInstance)(),getEventQueueInstance(){if(!window.imEventQueue){var e="im_event_queue";window.imEventQueue=new _shared_im_EventQueue__WEBPACK_IMPORTED_MODULE_20__.EventQueue({getQueue:()=>{var t=()=>(localStorage.removeItem(e),(0,_shared_im_request__WEBPACK_IMPORTED_MODULE_19__.post)("al_im.php",{act:"a_messenger_queue_subscribe"}).then((e=>e[0])).then((t=>(localStorage.setItem(e,JSON.stringify(t)),t))));return Notifier.tabIsMaster()?t():new Promise(((i,a)=>{var o=()=>{if(Notifier.tabIsMaster())return t().then(i).catch(a);var r=localStorage.getItem(e);if(!r)return setTimeout(o,3e3);try{i(JSON.parse(r))}catch(e){a(e)}};o()}))},registerQueue:(t,i)=>{Notifier.addKey(t,((t,a)=>{!(!a.failed&&!a.err)&&Notifier.tabIsMaster()&&localStorage.removeItem(e),i(t,a)}))}})}return window.imEventQueue},pushEvents:function(e,t){var i=0;each(e,(function(e,a){i|=Notifier.pushEvent(a,t)})),i&&!ls.get("sound_notify_off")&&curNotifier.is_server&&!1&i&&curNotifier.sound.play()},pushEvent:function pushEvent(ev,cnt){if("nop"!==ev){if("string"==typeof ev)try{ev=JSON.parse(ev)}catch(e){return void(0,_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_6__.logEvalError)(e,ev)}ev.timeoutConf={default:ev.timeout?ev.timeout:NOTIFICATION_FADE_TIMEOUT,default_am:ev.timeout?5*ev.timeout:NOTIFICATION_FADE_TIMEOUT_ACCESSIBILITY_MODE,unfreeze:ev.timeout?.7*ev.timeout:NOTIFICATION_FADE_TIMEOUT_AFTER_UNFREEZE,unfreeze_am:ev.timeout?4.4*ev.timeout:NOTIFICATION_FADE_TIMEOUT_ACCESSIBILITY_MODE_AFTER_UNFREEZE};var push=cnt?0:1,push_prioritized=!1;if(ev.version!==curNotifier.version&&-1!==ev.version)return debugLog("Notifier old version: "+ev.version+" !== "+curNotifier.version),!1;if("update_cnt"===ev.type){if(ev.add&&ev.add.section){if((0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_longpoll_unread_counter")&&"msg"===ev.add.section_id)return 0;handlePageCount(ev.add.section_id,ev.add.count,ev.add.section_link,ev.add.section_add)}return 0}if(!curNotifier.done_events[ev.id]){switch(curNotifier.done_events[ev.id]=1,void 0!==ev.top_count&&-1!==ev.top_count&&handlePageCount("ntf",ev.top_count),ev.type){case"video_process_ready":if(ev.add.video_raw&&window.Video&&Video.isVideoPlayerOpen(ev.add.video_raw))return;if(ev.add&&window.Video&&Video.isVideoPlayerOpen(ev.add))return;break;case"mail":if((0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_longpoll_unread_counter"))break;ev.add&&null!==ev.add.count&&void 0!==ev.add.count&&handlePageCount("msg",ev.add.count);break;case"friend_request":ev.add.fr_count?handlePageCount("fr",ev.add.fr_count):handlePageCount("fr",ev.add);break;case"friend_request_counter":handlePageCount("fr",ev.add.fr_count),push=0;break;case"ach_achieved":ev.add.cnt&&handlePageCount("ach",ev.add.cnt);break;case"ach_achieved_upd":handlePageCount("ach",ev.add),push=0;break;case"group_update_addresses":window.opener&&window.opener.postMessage(ev.add,window.opener.origin),push=0;break;case"bt_upd":if(ev.add.cnt){handlePageCount("bt",ev.add.cnt);var bt=ge("bt_tab_updates");bt&&val(geByClass1("ui_tab_count",bt),ev.add.cnt>0?ev.add.cnt:"")}break;case"bt_upd_upd":ev.add&&ev.add.section&&handlePageCount("bt",ev.add.count,ev.add.section,ev.add.prefix),push=0;var bt=ge("bt_tab_updates");bt&&val(geByClass1("ui_tab_count",bt),ev.add>0?ev.add:"");break;case"push_settings":push=0;var muted=JSON.parse(ev.add);curNotifier.mutedPeers=curNotifier.mutedPeers.filter((function(e){return e!==muted.peer_id})),0!==muted.disabled_until&&curNotifier.mutedPeers.push(muted.peer_id);break;case"mail_cnt":if(push=0,(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_longpoll_unread_counter"))break;handlePageCount("msg",ev.add);break;case"clear_notify":TopNotifier&&TopNotifier.invalidate(),Notifier.hideAllEvents(),push=0;break;case"support_reply":handlePageCount("spr",ev.add,"support",ev.author_id?"act=show&id="+ev.author_id:"act=show"),toggle("l_spr",ev.add>0);break;case"support_cnt":handlePageCount("spr",ev.add,"support",ev.author_id?"act=show&id="+ev.author_id:"act=show"),toggle("l_spr",ev.add>0),push=0;break;case"balance_changed":parseInt(ev.add.balance)?updateMoney(parseInt(ev.add.balance)):parseInt(ev.add)&&updateMoney(parseInt(ev.add));break;case"gift_sent":re("left_block10_0");var left_block=ev.add;if(left_block){var leftBlocksElem=ge("left_blocks"),left_unpaid_gifts=se(left_block);leftBlocksElem&&(leftBlocksElem.firstChild?leftBlocksElem.insertBefore(left_unpaid_gifts,leftBlocksElem.firstChild):leftBlocksElem.appendChild(left_unpaid_gifts))}break;case"notify_tt":case"login_attempt":if(ev.add.text&&ev.add.key){var evalText=`(${ev.add})`;try{ev.add=eval(evalText),TopNotifier.showTooltip(ev.add.text,ev.add.key)}catch(e){(0,_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_6__.logEvalError)(e,evalText)}push=0}break;case"reload_stickers":window.Emoji&&window.Emoji.stickers&&(Emoji.stickers=!1),push=0;break;case"reload_stickers_keywords":window.stickersKeywordsData=null,ls.remove("stickers_keywords"),window.Emoji&&Emoji.updateTabs(),push=0;break;case"any_counter":if(push=0,(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_longpoll_unread_counter")&&"msg"===ev.add.section_id)break;handlePageCount(ev.add.section_id,ev.add.count,ev.add.link,ev.add.add);break;case"done_box":case"done_box_full":push=0,push_prioritized=!0;break;case _web_market_HappySanta__WEBPACK_IMPORTED_MODULE_18__.MARKET_NOTIFY_ID__HS_MIGRATION_STATE:push=0,(0,_web_market_HappySanta__WEBPACK_IMPORTED_MODULE_18__.onHappySantaMarketMigrationStateChanged)(ev)}if("mail"===ev.type&&(push=this.sendMailNotification(ev)),ev.add&&ev.add.tooltip_text){var html='<div class="notify_tt_wrap">'+(ev.author_photo?`<img class="notify_tt_img" src="${ev.author_photo}" />`:'<div class="notify_tt_thumb"></div>')+'<h4 class="notify_tt_text">'+ev.add.tooltip_text+"</h4></div>";TopNotifier.showTooltip(html,0),push=0}return 1&push&&(curNotifier.q_events.push(ev),curNotifier.q_events.length>30&&curNotifier.q_events.splice(0,curNotifier.q_events.length-30),this.checkEvents()),push_prioritized&&(curNotifier.q_prior_events.push(ev),curNotifier.q_prior_events.length>5&&curNotifier.q_prior_events.splice(0,curNotifier.q_prior_events.length-5),this.checkEvents()),push}}},isActive:function(){return window.curNotifier&&curNotifier.idle_manager&&!curNotifier.idle_manager.is_idle},sendImProxy:function(e){e.text=winToUtf(e.text),curNotifier.browser_shown[e.id]||(curNotifier.browser_shown[e.id]=!0,Notifier.trySendBrowserNotification(e,!0),setTimeout((function(){curNotifier.browser_shown[e.id]=void 0}),2e3))},shouldShowNotification:function(e){return"im"!==cur.module&&!FastChat.isChatOpen(e.author_id)},sendSimpleNotification:function(e){return Notifier.playSound(e),Notifier.shouldShowNotification(e)?3:0},sendBrowserNotification:function(e){"im"!==cur.module?Notifier.negotiate({message:"send_im_notification",onSuccess:function(t){Notifier.lcSend("negotiate_back",{token:t.msg,ev:e})},onFail:function(){Notifier.showBrowserNotification(e)}}):(e.onclick="IMBRIDGE.activateTab("+e.author_id+");",Notifier.showBrowserNotification(e))},shouldPlaySound:function(e){var t=e.add&&e.add.no_sound;return!ls.get("sound_notify_off")&&Notifier.shouldDisturb(e)&&!t},shouldDisturb:e=>!cur.noDisturbMode&&(cur.focused!=e.author_id&&!inArray(e.author_id,cur.mutedPeers)&&!inArray(e.author_id,curNotifier.mutedPeers)),shouldPlayCurrentSound:function(e){return!ls.get("sound_notify_off")&&cur.focused==e.author_id&&(0,_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__.hasAccessibilityMode)()&&!inArray(e.author_id,cur.mutedPeers)},playSound:function(e){curNotifier.sound_im&&curNotifier.sound_im.play&&Notifier.shouldPlaySound(e)?e.author_id==cur.peer&&(0,_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__.hasAccessibilityMode)()?curNotifier.sound_im_current.play():curNotifier.sound_im.play():Notifier.shouldPlayCurrentSound(e)&&curNotifier.sound_im_current&&curNotifier.sound_im_current.play()},trySendBrowserNotification:function(e,t){Notifier.negotiate({message:"who_is_active",msg:e.author_id,onFail:function(){!Notifier.canNotifyUi()||cur.peer==e.author_id&&Notifier.isActive()?(t||(Notifier.lcSend("show_notification",e),Notifier.shouldShowNotification(e)&&Notifier.showEvent(e,!0)),Notifier.playSound(e)):Notifier.sendBrowserNotification(e)}})},showBrowserNotification:function(e){Notifier.showEventUi(e),Notifier.playSound(e)},proxyIm:function(e){if(this.isActive())return this.playSound(e),void(Notifier.canNotifyUi()&&cur.peer!==e.author_id&&Notifier.shouldDisturb(e)&&(e.onclick="IMBRIDGE.activateTab("+e.author_id+");",Notifier.showEventUi(e)));curNotifier.is_server?(e.onclick="IMBRIDGE.activateTab("+e.author_id+");",this.sendImProxy(e)):curNotifier.is_server||this.lcSend("message_from_im",e)},sendMailNotification:function(e){if(e.add.is_call)return 0;if("im"===cur.module?e.onclick="IMBRIDGE.activateTab('"+e.author_id+"');":(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_fastchat_reforged")?e.onclick=`window.reforgedME && window.reforgedME.selectPeer && window.reforgedME.selectPeer(${intval(e.author_id)}, 'notifications');`:e.onclick="FastChat.selectPeer('"+e.author_id+"');",this.isActive()&&Notifier.canNotifyUi())this.playSound(e),this.shouldDisturb(e)&&cur.peer!=e.author_id&&this.showEventUi(e);else{if(this.isActive()&&this.shouldDisturb(e))return this.sendSimpleNotification(e);curNotifier.is_server&&this.shouldDisturb(e)&&this.trySendBrowserNotification(e)}return 0},checkEvents:function(){var e;window.curNotifier&&curNotifier.idle_manager&&((!curNotifier.q_events.length||curNotifier.q_shown.length>=(curNotifier.idle_manager.is_idle?curNotifier.q_idle_max:curNotifier.q_max))&&!curNotifier.q_prior_events.length||!curNotifier.idle_manager.is_idle&&curNotifier.frozen||cur.noDisturbMode||(e=curNotifier.q_prior_events.length?curNotifier.q_prior_events.shift():curNotifier.q_events.shift())&&this.showEvent(e))},showEvent:function showEvent(ev,force){"mail"!==ev.type&&Math.random()<.1&&statlogsValueEvent("feed_top_notify_popup",1,"show",ev.type),curNotifier.q_shown.push(ev);var thumbEl=showEventThumb(ev),addPhoto=showEventAddPhoto(ev);ev.baloonWrapEl=ce("div",{className:"notifier_baloon_wrap",innerHTML:`\n        <div class="notifier_baloon notifier_type_${ev.type}">\n          <div class="notifier_baloon_head clear_fix">\n            <a class="notifier_close_wrap" role="link" title="${getLang("global_close")}" aria-label="${getLang("global_close")}"></a>\n            <h4 class="notifier_baloon_title">${ev.title||""}</h4>\n          </div>\n          <div class="notifier_baloon_body clear_fix">\n            ${thumbEl}\n            ${addPhoto}\n            <div class="notifier_baloon_msg wrapped">${ev.text||""}</div>\n          </div>\n        </div>`}),!ge("notifier_popup_icon_mask")&&ev.icon_type&&(utilsNode.appendChild(document.createElement("div")).outerHTML='<svg style="display: block;" width="0" height="0"><defs><clipPath id="notifier_popup_icon_mask"><path d="M48.254 34.197A9.958 9.958 0 0 0 42 32c-5.523 0-10 4.477-10 10 0 2.367.822 4.542 2.197 6.254A24.934 24.934 0 0 1 25 50C11.193 50 0 38.807 0 25S11.193 0 25 0s25 11.193 25 25c0 3.247-.62 6.35-1.746 9.197z"/></clipPath></defs></svg>'),ev.baloonEl=geByClass1("notifier_baloon",ev.baloonWrapEl),ev.closeEl=geByClass1("notifier_close_wrap",ev.baloonEl),addEvent(ev.baloonEl,"mouseover mouseout",(function(e){ev.over="mouseover"==e.type,ev.over?Notifier.freezeEvents():Notifier.unfreezeEvents()})),addEvent(ev.baloonEl,"mousedown click",(function(event){event=event.originalEvent||event||window.event;var btn=event.which,nohide=!1;if(1==btn&&(event.ctrlKey||browser.mac&&event.metaKey)&&(btn=2,browser.mac&&(nohide=!0)),"A"!=(event.target||event.srcElement).tagName){switch("mail"!==ev.type&&Math.random()<.1&&statlogsValueEvent("feed_top_notify_popup",1,"click",ev.type),btn){case 1:try{eval(ev.onclick)}catch(e){(0,_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_6__.logEvalError)(e,ev.onclick)}Notifier.trackEvent("click",{event_id:ev.id}),ev.preventHideByClick||Notifier.hideEvent(ev);break;case 2:if(!ev.link)return;var wnd=window.open(ev.link,"_blank");try{wnd.blur(),window.focus()}catch(e){}Notifier.trackEvent("click",{event_id:ev.id}),nohide||Notifier.hideEvent(ev);break;case 3:if(browser.mozilla)return}return cancelEvent(event)}})),addEvent(ev.baloonEl,"contextmenu",(function(e){return setTimeout((function(){Notifier.hideEvent(ev,!1,!1,!0)}),10),cancelEvent(e)})),addEvent(ev.closeEl,"mousedown click",(function(e){return Notifier.hideEvent(ev,!1,!1,!0),cancelEvent(e)})),ev.startFading=function(){ev.fading=animate(ev.baloonEl,{opacity:0},1e3,Notifier.hideEvent.bind(Notifier).pbind(ev,!1)),ev.over&&ev.fading.stop()},curNotifier.cont.insertBefore(ev.baloonWrapEl,curNotifier.cont.firstChild);var h=ev.baloonWrapEl.offsetHeight;re(ev.baloonWrapEl),curNotifier.cont.appendChild(ev.baloonWrapEl),setStyle(curNotifier.cont,{bottom:-h}),setStyle(ev.baloonWrapEl,{visibility:"visible"}),animate(curNotifier.cont,{bottom:0},200),curNotifier.idle_manager.is_idle&&!force||(ev.timeoutConf?ev.fadeTO=setTimeout(ev.startFading,(0,_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__.hasAccessibilityMode)()?ev.timeoutConf.default_am:ev.timeoutConf.default):ev.fadeTO=setTimeout(ev.startFading,(0,_web_lib_accessibility__WEBPACK_IMPORTED_MODULE_7__.hasAccessibilityMode)()?NOTIFICATION_FADE_TIMEOUT_ACCESSIBILITY_MODE:NOTIFICATION_FADE_TIMEOUT)),(0,_shared_lib_common__WEBPACK_IMPORTED_MODULE_10__.isFunction)(ev.tooltipHandler)&&ev.tooltipHandler(ev.baloonWrapEl,{ev,hide:()=>{Notifier.hideEvent(ev,!1,!1,!0)}})},trackEvent:function(e,t){ajax.post("al_feed.php",extend({act:"a_feedback_track_event",event:e},t||{}))},canNotifyUi:function(){if(window.pushNotifier&&window.pushNotifier.loadEndpoint())return!1;var e="im_notify_flag",t=!ls.get("im_ui_notify_off")&&DesktopNotifications.supported()&&DesktopNotifications.checkPermissionNeeded()<=0;return!ls.get(e)&&t&&ls.set(e,1),t&&!cur.noDisturbMode},showEventUi:function showEventUi(ev){if(!this.canNotifyUi())return!1;var title,text;if("mail"===ev.type){var div=ce("div");div.innerHTML=ev.text,title=div.firstChild.textContent.trim(),text=stripHTML(replaceEntities(ev.text.replace(/<br\/?>/g,"\n")).replace(/<span class='notifier_author_quote'.*<\/span>(.*?)/,"$1").replace(/<img.*?alt="(.*?)".*?>/gi,"$1")).replace(/&laquo;|&raquo;/gi,'"').trim()}else title=ev.title,text=ev.text;var notification=ev.uiNotification=DesktopNotifications.createNotification(ev.author_photo,title,text);return curNotifier.uiNotifications.push([notification,Date.now()]),notification.onclick=function(e){if(window.focus(),ev.onclick||("im"===cur.module?ev.onclick="IMBRIDGE.activateTab("+ev.author_id+");":(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_fastchat_reforged")?ev.onclick=`window.reforgedME && window.reforgedME.selectPeer && window.reforgedME.selectPeer(${intval(ev.author_id)}, 'notifications');`:ev.onclick="FastChat.selectPeer('"+ev.author_id+"');"),"IM"===ev.onclick.substr(0,2)&&"im"!==cur.module)(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_fastchat_reforged")?window.reforgedME&&window.reforgedME.selectPeer&&window.reforgedME.selectPeer(intval(ev.author_id),"notifications"):FastChat.selectPeer(intval(ev.author_id));else try{eval(ev.onclick)}catch(e){(0,_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_6__.logEvalError)(e,ev.onclick)}Notifier.hideEvent(ev)},notification.onclose=function(){Notifier.hideEvent(ev,!0)},notification.show(),ev.closeTO=setTimeout(Notifier.hideEvent.bind(Notifier).pbind(ev),5e3),!0},hideEvent:function(e,t,i,a){clearTimeout(e.closeTO),clearTimeout(e.fadeTO),e.fading&&e.fading.stop();var o,r=indexOf(curNotifier.q_shown,e);-1!=r&&curNotifier.q_shown.splice(r,1),Notifier.unfreezeEvents(),t||(e.baloonWrapEl?(cleanElems(e.closeEl,e.baloonEl),re(e.baloonWrapEl)):e.uiNotification&&e.uiNotification.cancel()),!0===a&&isArray(curNotifier.q_closed)&&(curNotifier.q_closed.unshift(vkNow()),(o=curNotifier.q_closed.length)>3&&(curNotifier.q_closed.splice(3,o-3),o=3),3==o&&curNotifier.q_closed[0]-curNotifier.q_closed[2]<700&&Notifier.hideAllEvents()),-1!=a&&this.checkEvents(),"frame"!=curNotifier.transport||i||this.lcSend("hide",{event_id:e.id}),!0!==a&&curNotifier.idle_manager.is_idle||curNotifier.q_events.length||curNotifier.q_shown.length||ajax.post("notifier.php",{act:"a_clear_notifier"}),(0,_shared_lib_common__WEBPACK_IMPORTED_MODULE_10__.isFunction)(e.onHide)&&e.onHide()},hideAllEvents:function(){curNotifier.q_events=[],each(clone(curNotifier.q_shown),(function(){Notifier.hideEvent(this,!1,!0,-1)})),curNotifier.q_shown=[],curNotifier.q_closed=[]},onEventHide:function(e){e&&(each(curNotifier.q_shown,(function(){if(this.id==e)return Notifier.hideEvent(this,!1,!0),!1})),each(curNotifier.q_events,(function(t){if(this.id==e)return curNotifier.q_events.splice(t,1),!1})))},lcInit:function(){addEvent(window,"storage",this.lcOnStorage.bind(this)),this.lcStart()},lcStart:function(){Notifier.lcCheckServer()?this.lcServer():(this.lcSend("check"),clearTimeout(curNotifier.becomeServerTO),curNotifier.becomeServerTO=setTimeout(this.lcServer.bind(this).pbind(!0),500)),curNotifier.checkServerInt=setInterval(function(){curNotifier.is_server||(curNotifier.idle_manager&&!curNotifier.idle_manager.is_idle&&curNotifier.idle_manager.getActiveTime()>ACTIVE_TAB_SWITCH_SERVER_TIMEOUT&&(Notifier.debug&&debugLog("this tab wants to become server"),ls.set(LC_SERVER_SWITCH_TO_ACTIVE_FLAG,!0),this.lcServer(!0)),vkNow()-curNotifier.last_succ>8e3&&Notifier.lcCheckServer()&&(Notifier.debug&&debugLog("timeout"),this.lcServer(!0)))}.bind(this),1e3+intval(rand(-100,100))),curNotifier.isServerBroadcastInt=setInterval(function(){curNotifier.is_server&&(Notifier.lcCheckServer()?this.lcSend("check_ok"):(Notifier.debug&&debugLog("no server from server broadcast"),this.lcNoServer()))}.bind(this),5e3+intval(rand(-100,100)));var e=(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("top_convo_list"),t=(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_13__.partConfigEnabled)("mail_fastchat_reforged");t||void 0!==curNotifier.fc&&stManager.add([jsc("web/emoji.js")],(function(){FastChat.init(curNotifier.fc)})),(t||e)&&loadReforgedFastchatModule().then((()=>{window.reforgedME.init({fcEnabled:t,tclEnabled:e,silentModules:curNotifier.fastchatsSilentModules||[]})}))},lcStop:function(){clearInterval(curNotifier.isServerBroadcastInt),clearInterval(curNotifier.checkServerInt),clearTimeout(curNotifier.becomeServerTO)},lcSend:function(e,t){if(!curNotifier.connection_id)return curNotifier.onConnectionId&&curNotifier.onConnectionId.push(Notifier.lcSend.pbind(e,t)),!1;Notifier.debug&&debugLog(curNotifier.instance_id+": sending",e,t||"");var i=extend({__client:curNotifier.instance_id,__act:e,__rnd:Math.random()},t||{});if(curNotifier.post_message)try{curNotifier.storage_frame.postMessage(curNotifier.connection_id+":"+JSON.stringify(i),curNotifier.storage_frame_origin)}catch(e){debugLog(e,e.message,e.stack)}else ls.set(curNotifier.connection_id,i)},lcRecv:function(e){if(e&&!isEmpty(e)&&e.__client!=curNotifier.instance_id){var t=e.__act;switch(delete e.__client,delete e.__act,delete e.__rnd,Notifier.debug&&debugLog(curNotifier.instance_id+": recv",t,e),t){case"new_server":curNotifier.last_succ=vkNow()+1e3;break;case"feed":curNotifier.timestamp=e.ts,curNotifier.key=e.key,Notifier.pushEvents(e.events,!e.full);break;case"addfeed":Notifier.addFeed(e[0],e[1]);break;case"new_key":debugLog("new key",e),curNotifier.timestamp=e.ts,curNotifier.key=e.key;break;case"new_addkey":var i=(0,_notifier_utils__WEBPACK_IMPORTED_MODULE_26__.subscriptionObjectStableId)(e),a=curNotifier.addQueues[i],o=!a&&curNotifier.is_server;a?a[0]=Date.now():curNotifier.addQueues[i]=[Date.now(),e.ts,e.key],o&&Notifier.lpReset(Notifier.lpCheck.bind(Notifier));break;case"clear_addkeys":curNotifier.addQueues={};break;case"check_ok":curNotifier.last_succ=Date.now(),curNotifier.becomeServerTO&&(clearTimeout(curNotifier.becomeServerTO),curNotifier.becomeServerTO=!1),curNotifier.lp_connected||(curNotifier.lp_connected=!0,Notifier.onConnectionInit());break;case"focus":Notifier.onInstanceFocus(e.instance_id);break;case"hide":Notifier.onEventHide(e.event_id);break;case"check_playlist":var r=ls.get("pad_playlist");r&&r.instance==curNotifier.instance_id&&ls.set("pad_pltime",vkNow());break;case"who_is_active":Notifier.isActive()&&(intval(e.msg)>2e9&&"im"===cur.module||intval(e.msg)<2e9)&&this.lcSend("negotiate_back",e);break;case"show_notification":Notifier.shouldShowNotification(e)&&Notifier.showEvent(e,!0);break;case"send_im_notification":if("im"===cur.module){var n=Notifier.createNegotiationSlot({onSuccess:function(e){e.ev.onclick="IMBRIDGE.activateTab("+e.ev.author_id+");",Notifier.showBrowserNotification(e.ev)}});Notifier.lcSend("negotiate_back",{msg:n.token,token:e.token})}break;case"negotiate_back":Notifier.endNegotiation(e);break;case"recent_emoji_set":window.Emoji&&Emoji.setRecentEmojiList(e);break;case"lp_data":IS_SSE_ENABLED||(0,_longpoll_singleton__WEBPACK_IMPORTED_MODULE_11__.lpSingletonOnNotifierRecv)(e);break;default:if(curNotifier.recvClbks&&curNotifier.recvClbks[t])for(var s in curNotifier.recvClbks[t])curNotifier.recvClbks[t][s](e);else curNotifier.recvData[t]=e}if(curNotifier.is_server)switch(t){case"new_server":case"new_key":case"check_ok":Notifier.debug&&debugLog("no server from lcRecv",t),Notifier.lcNoServer();break;case"check":this.lcSend("check_ok");break;case"message_from_im":Notifier.sendImProxy(e)}}},negotiate:function(e){e=this.createNegotiationSlot(e),this.lcSend(e.message,{token:e.token,msg:e.msg})},createNegotiationSlot:function(e){var t="negotiations_"+Date.now()+Math.round(rand(0,1e4));return e=extend({timeout:3e3,token:t,msg:""},e),curNotifier.negotiations[e.token]={},curNotifier.negotiations[e.token].timer=setTimeout((function(){e.onFail&&e.onFail(),curNotifier.negotiations[e.token]&&(curNotifier.negotiations[e.token]=void 0)}),e.timeout),curNotifier.negotiations[e.token].success=e.onSuccess,e},endNegotiation:function(e){var t=e.token,i=curNotifier.negotiations[t];i&&(clearTimeout(i.timer),curNotifier.negotiations[t].success&&curNotifier.negotiations[t].success(e),curNotifier.negotiations[t]=void 0)},lcOnStorage:function(e){e=e||window.event,Notifier.debug&&debugLog("onstorage",e.key,e.newValue,e);var t=e.key,i=e.newValue;if(i){if(t){if(e.key!=curNotifier.connection_id)return}else{if(t=curNotifier.connection_id,(i=localStorage.getItem(t))==curNotifier.lc_prev_value)return;curNotifier.lc_prev_value=i}this.lcRecv(JSON.parse(i)||{})}},lcServer:function(e){Notifier.debug&&debugLog("becoming server"),this.lpInit(),this.lcSend("new_server"),Notifier.lcCheckServer(!0),Notifier.onInstanceServer(1),curNotifier.lp_connected||(curNotifier.lp_connected=!0,Notifier.onConnectionInit()),this.lpStop(),e?this.lpReset(this.lpStart.bind(this)):this.lpStart()},lcNoServer:function(){this.lpStop(),curNotifier.is_server&&(Notifier.debug&&debugLog("not server now"),this.onInstanceServer(0))},lcCheckServer:function(e){var t,i="server_"+curNotifier.connection_id,a=vkNow();return!(!e&&isArray(t=ls.get(i))&&t[0]!=curNotifier.instance_id&&a-t[1]<8e3)&&(ls.set(i,[curNotifier.instance_id,a]),!0)},lpInit:function(){curNotifier.lpMakeRequest||(delete curNotifier.lpMakeRequest,re("queue_transport_frame"),Notifier.getTransportWrap().appendChild(ce("iframe",{id:"queue_transport_frame",name:"queue_transport_frame",src:curNotifier.frame_path})))},lpStart:function(){curNotifier.lp_started=!0,curNotifier.lpInvalid?Notifier.lpGetKey():Notifier.lpCheck()},lpStop:function(){curNotifier.lp_started=!1,clearTimeout(curNotifier.lp_check_to),clearTimeout(curNotifier.lp_error_to),clearTimeout(curNotifier.lp_req_check_to)},lpCheck:function lpCheck(){if(curNotifier.lp_started&&!curNotifier.lpActive&&!curNotifier.lpInvalid){if(!curNotifier.lpMakeRequest)return clearTimeout(curNotifier.lp_check_to),void(curNotifier.lp_check_to=setTimeout(this.lpCheck.bind(this),1e3));if(!Notifier.lcCheckServer())return Notifier.debug&&debugLog("no server from check"),void this.lcNoServer();var now=vkNow(),add_queues=[],completed=!1,params={act:"a_check",ts:curNotifier.timestamp,key:curNotifier.key,id:curNotifier.uid,wait:25};each(curNotifier.addQueues,(function(e,t){if(now-t[0]>3e4&&!e.match(/nccts/))return debugLog("drop key",e,now-t[0]),void delete curNotifier.addQueues[e];add_queues.push(e),params.ts+="_"+t[1],params.key+=t[2]}));var onFail=function(){completed||(completed=!0,curNotifier.lpActive=!1,clearTimeout(curNotifier.lp_req_check_to),clearTimeout(curNotifier.lp_error_to),curNotifier.lp_error_to=setTimeout(this.lpCheck.bind(this),1e3*errorTimeout.get()+irand(1e3,1e4)),errorTimeout.increase())}.bind(this);curNotifier.lpActive=!0,clearTimeout(curNotifier.lp_req_check_to),curNotifier.lp_req_check_to=setTimeout(onFail,1e3*(params.wait+5)),curNotifier.lpMakeRequest(curNotifier.frame_url,params,function(text){if(!completed&&(completed=!0,curNotifier.lpActive=!1,curNotifier.lp_started)){this.lcSend("check_ok");try{var response=eval("("+text+")"),main_response=response,add_response,add_queue,busy=0;if(isArray(response))for(main_response=response.shift();(add_response=response.shift())&&(add_queue=add_queues.shift(),add_queue);)2!=add_response.failed||4!=add_response.err?(this.lcSend("addfeed",[add_queue,add_response]),this.addFeed(add_queue,add_response),add_response.failed&&delete curNotifier.addQueues[add_queue]):(Notifier.debug&&debugLog("!!notifier key busy!! "+curNotifier.instance_id),busy|=1);else if(response.failed){for(;add_queue=add_queues.shift();)this.lcSend("addfeed",[add_queue,response]),this.addFeed(add_queue,response),delete curNotifier.addQueues[add_queue];this.lcSend("clear_addkeys")}switch(this.lpChecked(main_response)){case 0:break;case 1:default:return;case 2:busy|=2}busy?ls.get(LC_SERVER_SWITCH_TO_ACTIVE_FLAG)?ls.remove(LC_SERVER_SWITCH_TO_ACTIVE_FLAG):this.lcNoServer():(clearTimeout(curNotifier.lpCheckTO),curNotifier.lpCheckTO=setTimeout(this.lpCheck.bind(this),curNotifier.request_timeout||1e3),errorTimeout.decrease())}catch(e){text&&-1==text.indexOf("Ad Muncher")&&(topError("Notifier error: "+e.message,{dt:-1,type:5,stack:e.stack,answer:text+"\n\nbusy:"+busy+"\nserver:"+curNotifier.is_server+"\ninstance:"+curNotifier.instance_id,url:curNotifier.frame_url,query:params&&(0,_shared_lib_convert__WEBPACK_IMPORTED_MODULE_9__.toQueryString)(params)}),debugLog(e.message,e.stack,e)),clearTimeout(curNotifier.lp_error_to),curNotifier.lp_error_to=setTimeout(this.lpCheck.bind(this),1e3*errorTimeout.get()),errorTimeout.increase()}}}.bind(this),onFail)}},lpChecked:function(e){if(2==e.failed)return 4==e.err?2:(debugLog("notifier lpCheck error",e),curNotifier.lpInvalid=!0,clearTimeout(curNotifier.lp_error_to),curNotifier.lp_error_to=setTimeout(this.lpGetKey.bind(this),1e3*errorTimeout.get()),errorTimeout.increase(),1==e.err?1:3);if(e.failed)throw new Error(getLang("global_unknown_error"));return this.lcSend("feed",extend({full:curNotifier.idle_manager&&curNotifier.idle_manager.is_idle&&!this.canNotifyUi(),key:curNotifier.key},e)),curNotifier.timestamp=e.ts,Notifier.pushEvents(e.events),0},lpOnReset:function(){curNotifier.lpOnReset&&curNotifier.lpOnReset()},lpReset:function(e){curNotifier.lpOnReset=e,clearTimeout(curNotifier.resetTO),curNotifier.resetTO=setTimeout((function(){if(!curNotifier.is_server||curNotifier.lp_started){if(curNotifier.lpMakeRequest&&!curNotifier.lpInvalid){var e=curNotifier.key,t=curNotifier.timestamp;return each(curNotifier.addQueues,(function(i,a){e+=a[2],t+="_"+a[1]})),void curNotifier.lpMakeRequest(curNotifier.frame_url,{act:"a_release",key:e,ts:t,id:curNotifier.uid,wait:25},Notifier.lpOnReset,Notifier.lpOnReset)}ajax.post("notifier.php?act=a_reset",!1,{onDone:Notifier.lpOnReset,onFail:function(){return Notifier.lpOnReset(),!0}})}else Notifier.lpStart()}),100)},lpGetKey:function(){ajax.post("notifier.php?act=a_get_key",{id:curNotifier.uid,hash:curNotifier.notifierHash},{onDone:function(e,t){curNotifier.timestamp=t,curNotifier.key=e,curNotifier.lpInvalid=!1,debugLog("notifier lpGetKey done"),this.lcSend("new_key",{ts:t,key:e}),this.lpCheck()}.bind(this),onFail:function(e){switch(debugLog("notifier lpGetKey fail",e),e){case 1:case 3:return void Notifier.standby();case 4:return void Notifier.standby(300);case 2:return void Notifier.onRelogin();default:return errorTimeout.set(64),clearTimeout(this.lp_error_to),this.lp_error_to=setTimeout(this.lpGetKey.bind(this),1e3*errorTimeout.get()),!0}}.bind(this)})},addKey:function(e,t,i){var a;if(!e||!(null===(a=window.curNotifier)||void 0===a?void 0:a.addQueues))return!1;var o=(0,_notifier_utils__WEBPACK_IMPORTED_MODULE_26__.subscriptionObjectStableId)(e),r=curNotifier.addQueues[o],n=!r&&curNotifier.is_server;return r?(r[0]=vkNow(),r[3]=t,r[4]=i):curNotifier.addQueues[o]=[vkNow(),e.ts,e.key,t,i],i||Notifier.lcSend("new_addkey",e),n&&Notifier.lpReset(Notifier.lpCheck.bind(Notifier)),!0},addFeed:function(e,t){var i,a,o=null===(i=window.curNotifier)||void 0===i||null===(a=i.addQueues)||void 0===a?void 0:a[e];isArray(o)&&o.length&&(o[1]=t.ts,(0,_shared_lib_common__WEBPACK_IMPORTED_MODULE_10__.isFunction)(o[3])&&o[3](e,t))},addRecvClbk:function(e,t,i,a){curNotifier.recvClbks||(curNotifier.recvClbks={}),curNotifier.recvClbks[e]||(curNotifier.recvClbks[e]={}),curNotifier.recvClbks[e][t]&&!a||(curNotifier.recvClbks[e][t]=i)},setRecvClbk:function(e,t){curNotifier.recvClbks||(curNotifier.recvClbks={}),curNotifier.recvClbks[e]=[t]},fixPhoto:function(e,t){return-1===(e=clean(e)).indexOf("question_c.gif")?e:t?"/images/question_inv_xc.png":"/images/question_inv_c.png"},pauseGlobalMedia:function(){var e=!!(0,_shared_lib_site__WEBPACK_IMPORTED_MODULE_14__.isMvk)(),t=e?audio:(0,_web_lib_feature_entries__WEBPACK_IMPORTED_MODULE_15__.getAudioPlayer)(),i=window.Videoview;isMediaStoppedByCalls=!0,Notifier.lcSend("video_start"),!e&&t&&t.isPlaying()&&(t.pause(),t.pausedByCalls=!0),!e&&i&&(i.togglePlay(!1),i.pausedByCalls=!0),e&&t.playing&&t.playing()&&(t.pause(),t.pausedByCalls=!0)},resumeGlobalMedia:function(){var e=!!(0,_shared_lib_site__WEBPACK_IMPORTED_MODULE_14__.isMvk)(),t=e?audio:(0,_web_lib_feature_entries__WEBPACK_IMPORTED_MODULE_15__.getAudioPlayer)(),i=window.Videoview;isMediaStoppedByCalls&&(isMediaStoppedByCalls=!1,Notifier.lcSend("video_hide")),!e&&t&&t.pausedByCalls&&(t.play(),delete t.pausedByCalls),!e&&i&&i.pausedByCalls&&(i.togglePlay(!0),delete i.pausedByCalls),e&&t&&t.pausedByCalls&&((0,_shared_audio_utils_wrapAudioPlay__WEBPACK_IMPORTED_MODULE_16__.wrapAudioPlay)(t).catch((()=>{})),delete window.audio.pausedByCalls)}}},262928:(e,t,i)=>{"use strict";i(66108),i(296253);var a=i(386409),o=i(40906);window.curRBox||(window.curRBox={guid:0,active:!1,focused:[],tabs:{}});function r(e,t){var i=this;i.options=t=extend({minH:50,minW:50},t),i.content=e;var o=i.id="rb_box_"+(t.id||curRBox.guid++);i.wrap=ce("div",{id:o,className:"rb_box_wrap fixed"+(t.fixed?" fc_fixed":"")}),i.wrap.innerHTML+='<div class="tt-fastchat-wrap"></div>';var r={};i.toBottom=i.toRight=!1,t.fixed?(r.bottom=0,r.right=72):(void 0!==t.startTop?r.top=t.startTop:void 0!==t.startBottom&&(r.bottom=t.startBottom),void 0!==t.startLeft?r.left=t.startLeft:void 0!==t.startRight&&(r.right=t.startRight)),setStyle(i.wrap,r),t.movable&&addEvent(t.movable,"mousedown",i._head_mdown.bind(i)),i.resizeableH=t.resizeableH||e,t.startHeight&&setStyle(i.resizeableH,"height",t.startHeight),i.resizeableW=t.resizeableW||e,t.startWidth&&setStyle(i.resizeableW,"width",t.startWidth),addEvent(e,"mousedown",i._cont_mdown.bind(i)),t.closer&&(addEvent(t.closer,"mousedown",i._close_mdown.bind(i)),addEvent(t.closer,"click",i._close_click.bind(i))),t.hider&&(addEvent(t.hider,"mousedown",i._close_mdown.bind(i)),addEvent(t.hider,"click",i._hide_click.bind(i))),t.minimizer&&!0!==t.minimizer&&(addEvent(t.minimizer,"mousedown",i._close_mdown.bind(i)),addEvent(t.minimizer,"click",i._min_toggle.bind(i))),i.wrap.appendChild(e),!1!==t.resize&&(i.resizeWrap=ce("div",{className:"rb_resize_wrap",innerHTML:'<div class="chats_sp rb_resize"></div>'}),i.wrap.appendChild(i.resizeWrap),addEvent(i.resizeWrap,"mousedown",i._resize_mdown.bind(i))),t.minimized&&(addClass(i.wrap,"rb_minimized"),i.minimized=!0),bodyNode.insertBefore(i.wrap,ge("page_wrap"));var n=getStyle(i.wrap,"top"),s=getStyle(i.wrap,"bottom"),c=getStyle(i.wrap,"left"),l=getStyle(i.wrap,"right");this.toBottom=("auto"===n||""===n||browser.msie&&0===n)&&"auto"!=s&&""!==s&&!(browser.msie&&0===s),this.toRight=("auto"===c||""===c||browser.msie&&0===c)&&"auto"!=l&&""!==l&&!(browser.msie&&0===l),this.toRight&&setStyle(i.wrap,{marginRight:lastWndScroll[0]?(0,a.sbWidth)():0}),(t.nofocus||t.noshow)&&addClass(i.wrap,"rb_inactive"),this.toBottom&&(setStyle(i.wrap,{marginRight:lastWndScroll[0]?(0,a.sbWidth)():0}),addClass(i.wrap,"fc_tobottom")),this.options.marginFixedToLayer&&setStyle(i.wrap,{marginRight:hasClass(document.body,"layers_shown")?(0,a.sbWidth)():0}),curRBox.tabs[o]=i,i.pos=!1,t.noshow?(setStyle(i.wrap,{visibility:"hidden",display:"block"}),i._update_pos(),setStyle(i.wrap,{visibility:"",display:""})):i.show(!1,t.nofocus)}extend(r.prototype,{show:function(e){function t(t,i){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){var i=this;void 0===e&&(e=0),e?(setStyle(i.wrap,{opacity:0,display:"block"}),i.visible=!0,!t&&i.focus(),animate(i.wrap,{opacity:1},e,(function(){setStyle(i.wrap,browser.msie?{filter:"none"}:{opacity:""}),i._update_pos()}))):(show(i.wrap),i.visible=!0,!t&&i.focus(),i._update_pos()),i.options.onShow&&i.options.onShow()})),hide:function(e){function t(t,i,a){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t,i){var a=this;if(!t&&a.options.onBeforeHide&&a.options.onBeforeHide())return!0;void 0===e&&(e=0),e?(setStyle(a.wrap,{opacity:1,display:"block"}),animate(a.wrap,{opacity:0},e,(function(){hide(a.wrap),setStyle(a.wrap,browser.msie?{filter:"none"}:{opacity:""})}))):hide(a.wrap),a.visible=!1,!t&&a.options.onHide&&a.options.onHide(i||{})})),_head_mdown:function(e){if(!checkEvent(e)){(e.originalEvent||e).cancelBubble=!0;var t,i,o=this,r=e.target,n=getWndInner(),s=curRBox.active==o.id,c=e.pageY,l=e.pageX,_=o.wrap.offsetHeight,d=o.wrap.offsetWidth,u=0,f=0,h=n[0]-_,p=n[1]-d,v=browser.msie?"selectstart":"mousedown";o.options.fixed&&FastChat.pinTab(o.options.peer||-1,e,!0),s||o.focus(e),o.toBottom?(o.toBottom=!1,t=n[0]-intval(getStyle(o.wrap,"bottom"))-_,setStyle(o.wrap,{top:t,bottom:"auto"}),removeClass(o.wrap,"fc_tobottom")):t=intval(getStyle(o.wrap,"top")),o.toRight?(o.toRight=!1,i=n[1]-intval(getStyle(o.wrap,"right"))-d,setStyle(o.wrap,{left:i,right:"auto"})):i=intval(getStyle(o.wrap,"left")),u=t,f=i,cur._fcdrag=1;var g=function(e){return u=Math.max(0,Math.min(h,t+e.pageY-c)),h-u<10?u=h:u<10&&(u=0),o.wrap.style.top=u+"px",f=Math.max(0,Math.min(p,i+e.pageX-l)),p-f<10?f=p:f<10&&(f=0),o.wrap.style.left=f+"px",cancelEvent(e)};return addEvent(document,"mousemove",g),addEvent(document,"mouseup",(function e(t){cur._fcdrag=0,removeEvent(document,"mousemove",g),removeEvent(document,"mouseup",e),removeEvent(document,v,cancelEvent),setStyle(bodyNode,"cursor",""),setStyle(r,"cursor",""),(o.toBottom=u>=h-5)&&(setStyle(o.wrap,{top:"auto",bottom:0}),addClass(o.wrap,"fc_tobottom")),(o.toRight=f>=p-5)&&setStyle(o.wrap,{left:"auto",right:0,marginRight:lastWndScroll[0]?(0,a.sbWidth)():0}),o._update_pos();var i=Math.abs(t.pageY-c)<3&&Math.abs(t.pageX-l)<3;cur._fcpromo>0?cur._fcpromo=i?0:-1:o.options.minimizer&&i?!o.minimized&&s?o.minimize(!0):o.minimized&&o.unminimize(!0):o.options.onDragEnd&&o.options.onDragEnd(o.toBottom?-1:u/n[0],o.toRight?-1:f/n[1])})),addEvent(document,v,cancelEvent),setStyle(bodyNode,"cursor","move"),setStyle(r,"cursor","move"),!1}},_resize_mdown:function(e){if(!checkEvent(e)){this.focus(e);var t,i,o=this,r=e.target,n=getWndInner(),s=e.pageY,c=e.pageX,l=o.wrap.offsetHeight,_=o.wrap.offsetWidth,d=0,u=0,f=o.resizeableH.clientHeight-intval(getStyle(o.resizeableH,"paddingBottom"))-intval(getStyle(o.resizeableH,"paddingTop")),h=o.resizeableW.clientWidth-intval(getStyle(o.resizeableW,"paddingRight"))-intval(getStyle(o.resizeableW,"paddingLeft")),p=browser.msie?"selectstart":"mousedown",v=!browser.msie&&o.options.onResize||!1;o.toBottom?(o.toBottom=!1,t=n[0]-intval(getStyle(o.wrap,"bottom"))-l,setStyle(o.wrap,{top:t,bottom:"auto"}),removeClass(o.wrap,"fc_tobottom")):t=intval(getStyle(o.wrap,"top")),o.toRight?(o.toRight=!1,i=n[1]-intval(getStyle(o.wrap,"right"))-_,setStyle(o.wrap,{left:i,right:"auto"})):i=intval(getStyle(o.wrap,"left")),o.options.onResizeStart&&o.options.onResizeStart(f,h);var g=f+n[0]-t-l,m=h+n[1]-i-_,b=function(e){return d=Math.max(o.options.minH,Math.min(g,f+e.pageY-s)),g-d<10&&(d=g),o.resizeableH.style.height=d+"px",u=Math.max(o.options.minW,Math.min(m,h+e.pageX-c)),m-u<10&&(u=m),o.resizeableW.style.width=u+"px",v&&v(d,u),cancelEvent(e)};return addEvent(document,"mousemove",b),addEvent(document,"mouseup",(function e(t){removeEvent(document,"mousemove",b),removeEvent(document,"mouseup",e),removeEvent(document,p,cancelEvent),setStyle(bodyNode,"cursor",""),setStyle(r,"cursor",""),(o.toBottom=d==g)&&(setStyle(o.wrap,{top:"auto",bottom:0}),addClass(o.wrap,"fc_tobottom")),(o.toRight=u==m)&&setStyle(o.wrap,{left:"auto",right:0,marginRight:lastWndScroll[0]?(0,a.sbWidth)():0}),o._update_pos(),o.options.onResizeEnd&&o.options.onResizeEnd(d,u,n[0],n[1],o.toBottom,o.toRight)})),addEvent(document,p,cancelEvent),setStyle(bodyNode,"cursor","move"),setStyle(r,"cursor","move"),!1}},_update_pos:function(){var e=this;e.pos=[e.wrap.offsetTop,e.wrap.offsetLeft,e.wrap.offsetHeight,e.wrap.offsetWidth]},_wnd_resize:function(e,t,i){var a=this;a.toBottom&&(a.pos[0]=a.wrap.offsetTop),a.toRight&&(a.pos[1]=a.wrap.offsetLeft);var o={},r=!1,n=!1,s=a.pos[0]+a.pos[2]-e,c=a.pos[0],l=a.resizeableH.clientHeight-a.options.minH,_=a.pos[1]+a.pos[3]-t,d=a.pos[1],u=!1!==a.options.resize?a.resizeableW.clientWidth-a.options.minW:0;i&&(u<0&&setStyle(a.resizeableW,a.options.minW),l<0&&setStyle(a.resizeableH,a.options.minH)),(s<=0||c<=0&&l<=0)&&(_<=0||d<=0&&u<=0)||(s>0&&c>0&&(s-=c=Math.min(s,c),o.top=a.pos[0]-c,o.bottom=""),s>0&&l>0&&(l=Math.min(s,l),r=a.resizeableH.clientHeight-l),_>0&&d>0&&(_-=d=Math.min(_,d),o.left=a.pos[1]-d,o.right=""),_>0&&u>0&&(u=Math.min(_,u),n=a.resizeableW.clientWidth-u),!1!==n&&setStyle(a.resizeableW,"width",n),!1!==r&&setStyle(a.resizeableH,"height",r),setStyle(a.wrap,o),a._update_pos(),a.options.onResize&&a.options.onResize(a.resizeableH.clientHeight,a.resizeableW.clientWidth))},_cont_mdown:function(e){if(curRBox.active!=this.id&&(this.focus(e),!hasClass(e.target,"fc_editable")))return cancelEvent(e)},_focus:function(){var e=this,t=indexOf(curRBox.focused,e.id),i=curRBox.active,a=i&&curRBox.tabs[i];if(i!=e.id){a&&(0,o.isFunction)(a.options.onBlur)&&a.options.onBlur(),-1!=t&&curRBox.focused.splice(t,1),curRBox.focused.unshift(e.id);var r=1e4+curRBox.focused.length,n=!0;each(curRBox.focused,(function(e,t){var i=curRBox.tabs[t].wrap;n?(addClass(i,"rb_active"),removeClass(i,"rb_inactive"),curRBox.active=t,n=!1):(removeClass(i,"rb_active"),addClass(i,"rb_inactive")),setStyle(i,"zIndex",r),r--}))}},_hide_click:function(){this.hide()},minimize:function(e){var t=this,i=t.wrap;if(t.options.fixed)return!1;addClass(i,"rb_minimized"),t.minimized=!0,t._update_pos(),e&&t.options.onMinimize&&t.options.onMinimize(0)},unminimize:function(e){var t=this,i=t.wrap,a=getWndInner();removeClass(i,"rb_minimized"),t.minimized=!1,t._update_pos(),t._wnd_resize(a[0],a[1],!0),curRBox.active=!1,t.focus(),e&&t.options.onMinimize&&t.options.onMinimize(1)},_min_toggle:function(e){var t=this;setTimeout((function(){t.minimized?t.unminimize(!0):t.minimize(!0)}),50)},destroy:function(){var e=this,t=indexOf(curRBox.focused,e.id);-1!=t&&curRBox.focused.splice(t,1),cleanElems(e.wrap,e.resizeWrap,e.content,e.options.movable,e.options.closer,e.options.hider),re(e.wrap),delete curRBox.tabs[e.id]},_close_mdown:function(e){(e.originalEvent||e).cancelBubble=!0},_close_click:function(e){this.close()},_close:function(e){this.destroy(),curRBox.focused[0]&&!0!==e&&curRBox.tabs[curRBox.focused[0]].focus()},focus:function(e){var t=this,i=curRBox.active!=t.id||!0;return t._focus(),i&&(0,o.isFunction)(t.options.onFocus)&&t.options.onFocus(e),i},close:function(){var e=this,t=e.pos;e._close(),(0,o.isFunction)(e.options.onClose)&&e.options.onClose(t)}}),window.RBox=r},624817:()=>{"use strict";function e(e,t){var i,a,o=!1;if(!e)throw new Error("Undefined filename");t=t||{};try{o=!!(a=ce("audio")).canPlayType,"no"!=a.canPlayType("audio/mpeg")&&""!=a.canPlayType("audio/mpeg")?i=".mp3?1":"no"==a.canPlayType('audio/ogg; codecs="vorbis"')||""==a.canPlayType('audio/ogg; codecs="vorbis"')||t.forceMp3?o=!1:i=".ogg?1"}catch(e){}var r=t.forcePath||"/"+e+i;if(o){a.src=r;var n=!1;a.addEventListener("ended",(function(){n=!0}),!0),a.load(),this.playSound=function(){n&&a.load();try{var e=a.play();e&&e.catch((e=>{debugLog(e)}))}catch(e){}n=!1},this.pauseSound=function(){var e=a.pause();e&&e.catch((e=>{debugLog(e)}))}}else{cur.__sound_guid=cur.__sound_guid||0;var s=ge("flash_sounds_wrap")||utilsNode.appendChild(ce("span",{id:"flash_sounds_wrap"})),c="flash_sound_"+cur.__sound_guid++;if(renderFlash(s,{url:"/swf/audio_lite.swf?4",id:c},{swliveconnect:"true",allowscriptaccess:"always",wmode:"opaque"},{})){var l=browser.msie?window[c]:document[c],_=!1,d=setInterval((function(){if(l&&l.paused)try{l.setVolume(1),l.loadAudio(r),l.pauseAudio()}catch(e){debugLog(e)}_=!0,clearInterval(d)}),300);this.playSound=function(){_&&l.playAudio(0)},this.pauseSound=function(){_&&l.pauseAudio()}}}}e.prototype={play:function(){try{this.playSound()}catch(e){}},pause:function(){try{this.pauseSound()}catch(e){}}},window.Sound=e},669906:(__unused_webpack___webpack_module__,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(21466),core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(59357),core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(751876),core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(66108),core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(296253),_web_lib_dom_events__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(49535),_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(386409),_web_lib_message_box__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(654612),_web_lib_tooltip_utils__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(376852),_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(787481),_shared_user_user_env__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(19331),_shared_lib_js_logger__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(66433),_web_lib_fx__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(635676),_shared_lib_web_stats__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(171516),_shared_evbus__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(182804),_icons_desktop_getIcon20Check__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(244030),_icons_desktop_getIcon20Cancel__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(784502),_vkontakte_vkjs__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(659397),_web_lib_box_utils__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(486125);function _readOnlyError(e){throw new Error('"'+e+'" is read-only')}window.TopNotifierCur||(window.TopNotifierCur={link:"top_notify_btn",count:"top_notify_count",_qParams:{section:"notifications",_tb:1,list:""},loaded:!1,loading:!1,from:"",viewsObserver:null,viewedNotifications:[]}),window.TopNotifier={onBellMouseDown:function(e){return!(0,_web_lib_dom_events__WEBPACK_IMPORTED_MODULE_5__.checkKeyboardEvent)(e)&&TopNotifier.show(e)},onBellClick:function(e){return!!checkEvent(e)||!!(0,_web_lib_dom_events__WEBPACK_IMPORTED_MODULE_5__.checkKeyboardEvent)(e)&&TopNotifier.show(e)},onLoad:function onLoad(rows,js,from,header){if(!from||TopNotifierCur.from!==from){void 0!==rows&&"undefined"!==rows||(0,_shared_lib_js_logger__WEBPACK_IMPORTED_MODULE_11__.logError)("TopNotifier load undefinded response",{environment:"top_notify"});var evalExpr=`(function(){${js};})()`;try{eval(evalExpr)}catch(e){(0,_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_9__.logEvalError)(e,evalExpr)}TopNotifierCur.loaded=!0,val(TopNotifier.getContentNode(),rows),TopNotifier.trackViews(),show(geByClass1("top_notify_show_all")),TopNotifier.refreshHeader(header),TopNotifier.cleanCount(),TopNotifier.refreshCounters(),TopNotifierCur.from=from}},trackViews:function(){var e=ge("top_notify_cont");"IntersectionObserver"in window&&(TopNotifierCur.viewsObserver&&TopNotifierCur.viewsObserver.disconnect(),TopNotifierCur.viewsObserver=new IntersectionObserver((function(e){e.forEach((e=>{var t=e.target.parentNode.dataset.notification_id;e.isIntersecting&&-1===TopNotifierCur.viewedNotifications.indexOf(t)&&(TopNotifierCur.viewedNotifications.push(t),(0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_10__.partConfigEnabled)("notifications_view_new")?(0,_shared_lib_web_stats__WEBPACK_IMPORTED_MODULE_13__.saveStatlogEvents)({name:"notifications_views",value:t,keys:[]}):statlogsValueEvent("notifications_views",t))}))}),{root:e,threshold:.6}),geByClass("feedback_row",e).forEach((function(e){TopNotifierCur.viewsObserver.observe(e)})))},refreshHeader:function(e){var t,i=geByClass1("_notify_unread"),a=e&&!geByClass1("_top_notify_header"),o=i&&i.offsetHeight;if(a?(TopNotifierCur.header=se(e),t=ce("div",{className:"top_notify_header_label"}),TopNotifierCur.header.appendChild(t)):t=geByClass1("top_notify_header_label",TopNotifierCur.header),a){val(t,"");var r="";TopNotifierCur.notify_sources.forEach((function(e){""!==e.list&&e.list===TopNotifierCur._qParams.list&&(r=e.name)})),""===r&&(r=getLang("global_notifications_user"));var n,s=ce("div",{className:"top_notify_header_sup_label"}),c=ce("span",{className:"top_notify_header_label_user",innerHTML:r}),l=ce("span",{className:"top_notify_header_label_groups"}),_=ce("a",{onmouseover:function(e){TopNotifier.getSourcesTip(this,e)},className:"top_notify_header_label_groups_link",innerHTML:getLang("global_notifications_groups")});if(l.appendChild(_),n=ce("span",{className:"top_notify_header_label_groups_counter",innerHTML:""}),s.appendChild(c),cur.user_has_admined_groups>0&&(s.appendChild(l),s.appendChild(n)),t.appendChild(s),o){var d=ce("div",{className:"top_notify_header_sub_label",innerHTML:getLang("global_viewed_notifications")});t.appendChild(d)}}a&&TopNotifierCur.wrapper.insertBefore(TopNotifierCur.header,TopNotifierCur.wrapper.firstChild),TopNotifierCur.header_unread=geByClass1("_notify_header"),TopNotifierCur.header_unread&&(o?(TopNotifierCur.header_unread_hidden&&slideDown(TopNotifierCur.header_unread,100),TopNotifierCur.header_unread_hidden=!1,TopNotifierCur.header_unread_handler||(TopNotifierCur.header_unread_height=TopNotifierCur.header_unread.offsetHeight,TopNotifierCur.header_unread_handler=function(e){if(TopNotifierCur.header_unread){var t=TopNotifierCur.header_unread.offsetTop+TopNotifierCur.header_unread_height<e.data.scrollTop;t!=TopNotifierCur.swaped&&(toggleClass(TopNotifierCur.header,"top_notify_header_swap_labels",t),TopNotifierCur.swaped=t)}},TopNotifierCur.scrollbar.emitter.addListener("update",TopNotifierCur.header_unread_handler))):(TopNotifierCur.header_unread_hidden||slideUp(TopNotifierCur.header_unread,100),TopNotifierCur.header_unread_hidden=!0,TopNotifierCur.header_unread_handler&&(TopNotifierCur.scrollbar.emitter.removeListener("update",TopNotifierCur.header_unread_handler),TopNotifierCur.header_unread_handler=null)))},preload:function(){TopNotifier.shown()||vk.isBanned||TopNotifierCur.loaded||ajax.post("/al_feed.php",extend(clone(TopNotifierCur._qParams),{_preload:1}),{cache:1,onDone:function(e,t,i,a){TopNotifier.shown()&&geByClass1("pr","top_notify_cont")&&(TopNotifier.onLoad(e,t,i,a),TopNotifierCur.loaded=!0)},stat:["feed.css","page.css","post.css"]})},loadMore:function loadMore(){var btn=ge("ui_top_notify_load_more");btn&&!(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.isButtonLocked)(btn)&&(TopNotifierCur.ajax=ajax.post("/al_feed.php",extend(clone(TopNotifierCur._qParams),{from:TopNotifierCur.from,more:1,need_header:intval(!(geByClass1("_notify_header")||!geByClass1("_notify_sticky")&&!geByClass1("_notify_unread")))}),{onDone:function onDone(rows,js,newFrom){if(TopNotifierCur.scrollbar){var evalExpr=`(function(){${js};})()`;try{eval(evalExpr)}catch(e){(0,_web_lib_debug_tools__WEBPACK_IMPORTED_MODULE_9__.logEvalError)(e,evalExpr)}if(rows){for(var row=null,cont=TopNotifier.getContentNode(),au=cf(rows);row=au.firstChild;)cont.insertBefore(row,btn);TopNotifier.refreshHeader(),TopNotifier.trackViews()}newFrom?TopNotifierCur.from=newFrom:re(btn)}},showProgress:function(){show(btn),(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton)(btn)},hideProgress:function(){hide(btn),(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton)(btn)}}))},updateTime:function(e){each(geByClass("rel_date_needs_update",e,"span"),(function(e,t){if(t){var i=intval(t.getAttribute("time")),a=60*((new Date).getTimezoneOffset()+180),o=getDateText(i,a);!0===hasClass(this,"ucfirst")&&(o=o.charAt(0).toUpperCase()+o.slice(1)),t.innerHTML=o}}))},createNewEventsBox:function(e){if((0,_shared_user_user_env__WEBPACK_IMPORTED_MODULE_10__.partConfigEnabled)("notify_new_events_box")){var t=TopNotifier.getContentNode();if(t){var i=geByClass1("notifications_new_events",t);e>0?(i||((i=document.createElement("div")).className="feed_row _feed_row notifications_new_events",i.onclick=function(e){i.onclick=null,showProgress(i),TopNotifierCur._qParams.list="",TopNotifier.refresh(e,!1)}),i.innerHTML=langStr(getLang("notifications_new_events",e),"count",e),t.insertBefore(i,t.children[0])):i&&!TopNotifierCur.loading&&re(i)}}},show:function(e){if(gpeByClass("top_notify_cont",e.target))return!0;if(!0!==checkEvent(e)&&!vk.isBanned){if(TopNotifier.shown())return gpeByClass("top_notify_wrap",e.target,ge("top_nav"))||TopNotifier.hide(),cancelEvent(e);var t=ge(TopNotifierCur.link),i=ge("top_notify_cont");TopNotifier.updateTime(i),TopNotifierCur.timeUpdateInt=setInterval((function(){TopNotifier.updateTime(i)}),1e4),cur.introNotifyTooltipHide&&(cur.introNotifyTooltipHide(),delete cur.introNotifyTooltipHide),t.tt&&t.tt.hide&&t.tt.hide(),i||(TopNotifierCur.wrapper=ce("div",{innerHTML:'<div id="top_notify_cont" class="top_notify_cont wall_module" ontouchstart="event.cancelBubble = true;" onmousedown="event.cancelBubble = true;"></div><a href="/feed?section=notifications'+(TopNotifierCur._qParams.list?"&list="+TopNotifierCur._qParams.list:"")+'" class="top_notify_show_all" onmousedown="event.cancelBubble = true;" onclick="TopNotifier.hide(); return nav.go(this, event);">'+getLang("global_notify_show_all")+"</a>",id:"top_notify_wrap",className:"scroll_fix_wrap top_notify_wrap"}),t.appendChild(TopNotifierCur.wrapper),i=ge("top_notify_cont"));var a=window.innerHeight||document.documentElement.clientHeight;setStyle(i,{maxHeight:Math.min(Math.max(a-200,300),600)}),addClass(TopNotifierCur.link,"TopNavBtn--active");var o=uiScroll;return TopNotifierCur.scrollbar&&TopNotifierCur.scrollbar.container.__uiScroll__||(TopNotifierCur.scrollbar=new o(i,{global:!0,stopScrollPropagationAlways:!0,onmore:TopNotifier.loadMore})),TopNotifierCur.loaded?TopNotifier.trackViews():TopNotifier.refresh(),window.pushNotifier&&window.pushNotifier.cleanNotification(),cancelStackPush("top_notifier",TopNotifier.hide.bind(TopNotifier),!0),cancelEvent(e)}},hide:function(){TopNotifier.shown()&&(TopNotifierCur.viewedNotifications=[],removeClass(TopNotifierCur.link,"TopNavBtn--active"),clearInterval(TopNotifierCur.timeUpdateInt),cancelStackFilter("top_notifier",!0),""!==TopNotifierCur._qParams.list&&(TopNotifierCur._qParams.list="",TopNotifier.invalidate()))},shown:function(){return hasClass(TopNotifierCur.link,"TopNavBtn--active")},getContentNode:function(){return TopNotifierCur.scrollbar&&TopNotifierCur.scrollbar.content&&TopNotifierCur.scrollbar.container.__uiScroll__?TopNotifierCur.scrollbar.content:ge("top_notify_cont")},showProgress:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=TopNotifier.getContentNode();geByClass1("pr",e)||(val(e,""),showProgress(e))})),hideProgress:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=TopNotifier.getContentNode();val(e,""),hideProgress(e)})),showTooltip:function(e,t){if(!TopNotifier.shown()&&!isVisible("dev_top_nav")){var i=ge(TopNotifierCur.link),a={};if(i){if("shownow"==i.tt&&removeAttr(i,"tt"),e)a.text=function(){return e},t&&(a.onHide=s.pbind(t));else{i.tt&&i.tt.destroy&&i.tt.destroy();var o=ls.get("ntfseen")||{},r=[];each(o,(function(e,t){r.push(e+":"+t)})),a=extend(a,{url:"al_feed.php",params:{act:"a_last_notify",seen:r.join(";")},ajaxdt:2e3,noload:1,onHide:s})}var n=function e(t){setTimeout((function(){window.curNotifier&&curNotifier.idle_manager&&curNotifier.idle_manager.is_idle?e(t):(t&&t.hide(),Notifier.lcSend("hide_notify_tt"))}),6e3)};(0,_web_lib_tooltip_utils__WEBPACK_IMPORTED_MODULE_8__.showTooltip)(i,extend(a,{typeClass:"top_notify_tt",dir:"up",width:250,shift:[1,0],nohideover:1,nohide:1,onShowStart:function(e){TopNotifier.shown()&&(e.opts.onHide=!1,e.hide()),addEvent(e.container,"mousedown",(function(e){if(!e||!inArray(e.target.tagName,["A","IMG"]))return TopNotifier.show(e),cancelEvent(e)})),n(e),Notifier.setRecvClbk("hide_notify_tt",e.hide)}}))}}function s(e){if(!e&&cur.topNotifyTTKey&&(e=cur.topNotifyTTKey,delete cur.topNotifyTTKey),e){var t=e.split(":"),i=ls.get("ntfseen")||{};2===t.length&&(i[0]=parseInt((new Date).getTime()/1e3),i[t[0]]=t[1],ls.set("ntfseen",i))}}},invalidate:function(){TopNotifierCur.loaded=!1,TopNotifierCur.from="",ajax.invalidate("/al_feed.php",TopNotifierCur._qParams),TopNotifierCur.ajax&&TopNotifierCur.ajax.abort()},setCount:function(e,t){isString(e)&&(e=trim(e)),parseInt(e)>=100&&(e="+99"),hasClass(TopNotifierCur.link,"has_notify")&&e?(0,_web_lib_fx__WEBPACK_IMPORTED_MODULE_12__.animateCount)(TopNotifierCur.count,e,{str:"auto"}):val(TopNotifierCur.count,e),toggleClass(TopNotifierCur.link,"has_notify",!!e),t||TopNotifier.invalidate()},cleanCount:function(){if(cur.topNotifyHash){var e=cur.groupNotify_readGids||[];cur.groupNotify_readGids=[],TopNotifierCur.notify_sources.forEach((function(t,i){var a=parseInt(t.list.replace("group-",""));t.list!==TopNotifierCur._qParams.list&&-1===e.indexOf(a)||(TopNotifierCur.notify_sources[i].counter=0)})),ajax.post("/al_feed.php",{act:"a_clean_notify",hash:cur.topNotifyHash,list:TopNotifierCur._qParams.list,gn_readGids:e})}},refresh:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null!==e&&cancelEvent(e),TopNotifier.invalidate(),TopNotifierCur.wrapper&&!TopNotifierCur.loading&&(TopNotifierCur.loading=!0,t&&(re(geByClass1("_notify_header")),re(geByClass1("_top_notify_header"))),TopNotifierCur.from=0,ajax.post("/al_feed.php",TopNotifierCur._qParams,{cache:1,onDone:(e,t,i,a)=>{TopNotifierCur.loading=!1,TopNotifier.onLoad(e,t,i,a)},showProgress:()=>{t&&TopNotifier.showProgress()},stat:["feed.css"],onFail(){TopNotifierCur.loading=!1,hide(geByClass1("top_notify_show_all")),TopNotifier.hideProgress(),val(TopNotifier.getContentNode(),'<div class="top_notify_empty no_rows error_message"><div>'+getLang("global_notify_error_occured")+'</div><button class="flat_button button_small secondary" onclick="TopNotifier.refresh(event);">'+getLang("global_notify_refresh")+"</button></div>")},no_ads_params:!0}))},unifiedDeleteRow:function(e,t,i,a,o){cancelEvent(e);var r=gpeByClass("feed_row",o),n=geByClass1("post_actions",r),s=geByClass1("feedback_row_wrap",r);ajax.post("al_feed.php",{act:"a_feedback_unified_delete",query:t,hash:i,from:"top_notifier"},{onDone:function(e){"."!==a.substr(-1)&&(a+=".");var o=getLang("notifications_cancel_disable"),n=`${a} <a onclick="TopNotifier.unifiedRestoreRow('${t}', '${i}', this);return cancelEvent(event);">${o}</a>`;e&&(n+="<br>"+e);var c=ce("div",{className:"feedback_deleted_container"});c.appendChild(ce("div",{className:"feedback_row dld _feedback_deleted _top_feedback_deleted",innerHTML:n})),r.appendChild(c),hide(s),hasClass(r,"feedback_row_clickable")&&addClass(r,"feedback_row_touched")},showProgress:addClass.pbind(n,"post_actions_progress"),hideProgress:removeClass.pbind(n,"post_actions_progress")})},unifiedRestoreRow:function(e,t,i){var a=gpeByClass("feed_row",i),o=gpeByClass("feedback_deleted_container",geByClass1("_feedback_deleted",a)),r=geByClass1("feedback_row_wrap",a);if(o&&r){var n=ce("span",{className:"progress_inline"});ajax.post("al_feed.php",{act:"a_feedback_unified_restore",query:e,hash:t,from:"top_notifier"},{onDone:function(){show(r),re(o),removeClass(a,"feedback_row_touched")},showProgress:()=>i.parentNode.replaceChild(n,i),hideProgress:()=>n.parentNode.replaceChild(i,n)})}},notifyMarkSpam:function(e,t){ajax.post("al_feed.php",{act:"a_feedback_mark_spam",item:e,hash:t},{onDone:function(t){ge("notify_mark_spam_"+e).innerHTML=t}})},notifyDeleteAll:function(e,t,i,a){if(cur.notifyDeletingAll||(cur.notifyDeletingAll={}),!cur.notifyDeletingAll[e]){cur.notifyDeletingAll[e]=1;var o=ce("span",{className:"progress_inline"});ajax.post("al_feed.php",{act:"a_feedback_delete_all",uid:e,item:i,hash:t},{onDone:function(t,i){var o=gpeByClass("_feedback_deleted",a);if(1!=i){var r,n=!1;if((n=hasClass(o,"_top_feedback_deleted")?ge("top_notify_cont"):cur.rowsCont)&&(r=n.firstChild)){var s,c,l=!1,_=scrollGetY();do{r.className&&hasClass(r,"_feed_row")&&r.firstChild&&e==r.firstChild.getAttribute("author")&&(s=r.offsetHeight,c=r.offsetTop,!1===l&&(l=getXY(r.offsetParent)[1]),hide(r),c+l<_&&(_-=s,scrollToY(_,0)))}while(r=r.nextSibling);(0===cur.wasScroll||cur.wasScroll>0)&&(cur.wasScroll=_)}o.innerHTML='<span class="dld_inner">'+t+"</span>"}else re(gpeByClass("_feed_row",o))},showProgress:function(){a&&"button"===a.tagName.toLowerCase()?(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton)(a):a.parentNode.replaceChild(o,a)},hideProgress:function(){a&&"button"===a.tagName.toLowerCase()?(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton)(a):o.parentNode.replaceChild(a,o)}})}},checkClick:function(e,t){if(t=t||window.event,!e||!t)return!0;TopNotifier.trackClick(t.target);var i=t.target||t.srcElement,a=8,o=!1,r=/(feedback_row)/;do{if(!i||i===e||i.onclick||i.onmousedown||inArray(i.tagName,["A","IMG","TEXTAREA","EMBED","OBJECT"])||(o=i.className.match(r)))break}while(a--&&(i=i.parentNode));return!!o&&(i||!0)},detectClickRegion:function(e){switch(e.tagName){case"BUTTON":for(var t=e.parentNode.childNodes,i=1,a=0;a<t.length;++a)t[a]===e&&(i=a+1);return"button"+i;case"IMG":return e.dataset.elementName;default:return e.parentNode.closest(".feedback_attachments")?"attachments":"cell"}},trackClick:function(e){var t=e.closest(".feedback_row");if(t){for(var i=t.parentNode,a=TopNotifier.detectClickRegion(e),o=-1,r=geByClass("feedback_row"),n=0;n<r.length;++n)if(r[n]===t){o=n;break}statlogsValueEvent("notifications_click",0,i.dataset.notification_type,o,i.dataset.notification_id,a)}},loadMoreUngrouped:(e,t,i)=>{ajax.post("/al_feed.php",{act:"ungroup_notifications",query:t,from:i},{onDone:(i,a,o)=>{if(!a&&o){if(!i)return TopNotifier.loadMoreUngrouped(e,t,o),!1;i+='<div class="feedback_group_loadmore_button" onclick="TopNotifier.loadMoreUngrouped(this, \''+t+"', '"+o+"')\">"+getLang("notifications_show_more")+"</div>"}e.outerHTML=i},showProgress:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((()=>{e.innerHTML="",showProgress(e)})),hideProgress:()=>e.innerHTML=getLang("notifications_show_more"),no_ads_params:!0})},ungroupUnified:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(null!==i){var o=gpeByClass("feed_row",e),r=geByClass1("post_actions",o);ajax.post("/al_feed.php",{act:"ungroup_notifications",query:i,from:a},{onDone:(a,o,r)=>{if(!o&&r){if(!a)return TopNotifier.ungroupUnified(e,t,i,r),!1;a+='<div class="feedback_group_loadmore_button" onclick="TopNotifier.loadMoreUngrouped(this, \''+i+"', '"+r+"')\">"+getLang("notifications_show_more")+"</div>"}e.parentNode.outerHTML=a},showProgress:addClass.pbind(r,"post_actions_progress"),hideProgress:removeClass.pbind(r,"post_actions_progress"),no_ads_params:!0})}else e=domClosest("_feed_row",e),show(domNS(e)),re(e);t.stopPropagation(),t.preventDefault()},showActionsMenu:function(e){var t=!1,i=domClosest("_feed_row",e),a=domPN(i);hasClass(a,"_notify_unread")&&(a=domPN(a)),a.lastChild!=i||hasClass(a,"feed_row_fb_hidden")||hasClass(a,"feedback_sticky_rows")&&domPN(a).lastChild!=a||(t={appendParentCls:"top_notify_wrap",processHoverCls:hasClass(domPN(e),"post_actions")?"feedback_row":"feedback_sticky_row"}),uiActionsMenu.show(e,!1,t)},hideActionsMenu:function(e){uiActionsMenu.hide(e)},frProcess:function(e,t,i,a){var o;(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.isButtonLocked)(i)||(o=a?{act:"add",mid:e,hash:t,request:1,from:"top_notifier"}:{act:"remove",mid:e,hash:t,report_spam:1,from:"top_notifier"},statlogsValueEvent("feed_top_notify",0,"friends",o.act),ajax.post("/al_friends.php",o,{onDone:function(t,o){var r=domPN(i);val(r,t),addClass(r,"feedback_buttons_response"),"friends"==cur.module&&window.Friends&&(val("request_controls_"+e,t),window.Friends.processRequest(e,a)),o&&(0,_web_lib_box_utils__WEBPACK_IMPORTED_MODULE_16__.showDoneBox)(o)},onFail:function(e){if(e)return setTimeout((0,_web_lib_message_box__WEBPACK_IMPORTED_MODULE_7__.showFastBox)(getLang("global_error"),e).hide,3e3),!0},showProgress:_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton.pbind(i),hideProgress:_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton.pbind(i)}))},apiCallProcess:function(e,t){if(!(0,_vkontakte_vkjs__WEBPACK_IMPORTED_MODULE_15__.isObject)(e)||(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.isButtonLocked)(t))return!1;var i=e.query,a=e.successText,o=e.successIcon,r=e.confirmTitle,n=e.confirmText,s=e.confirmOkLabel,c=e.confirmCancelLabel,l=e.snackbarText,_=e.replaceAllActions,d=function(){ajax.post("/al_feed.php",{act:"a_api_call",hash:cur.topNotifyHash,query:i},{onDone:function(e){var i;switch(o){case"done":i=(0,_icons_desktop_getIcon20Check__WEBPACK_IMPORTED_MODULE_17__.getIcon20Check)().icon;break;case"cancel":i=(0,_icons_desktop_getIcon20Cancel__WEBPACK_IMPORTED_MODULE_18__.getIcon20Cancel)().icon}var r=`<div class="feedback_apicallText">${i?`<div class="feedback_apicallText__icon">${i}</div>`:""}${a}</div>`;if(_){var n=t.parentElement;n&&(n.innerHTML=r)}else t.outerHTML=r;l&&(0,_web_lib_box_utils__WEBPACK_IMPORTED_MODULE_16__.showDoneBox)(l)},onFail:function(e){if(e)return setTimeout((0,_web_lib_message_box__WEBPACK_IMPORTED_MODULE_7__.showFastBox)(getLang("global_error"),e).hide,3e3),!0},showProgress:()=>(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton)(t),hideProgress:()=>(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton)(t)})};return n?(_readOnlyError("confirmTitle"),r=r||getLang("global_action_confirmation"),cur.confirmBox=(0,_web_lib_message_box__WEBPACK_IMPORTED_MODULE_7__.showFastBox)(r,n,s,(function(){d(),cur.confirmBox.hide()}),c)):d(),!0},grProcess:function(e,t,i,a){if(!(hasClass(i,"flat_button")&&(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.isButtonLocked)(i)||domFC(i)&&"progress_inline"==domFC(i))){var o=-2==a?"spam":a?"enter":"leave",r=-1==a?"_decline":"";ajax.post("/al_groups.php",{act:o,gid:e,hash:t,from:"top_notifier",context:r},{onDone:function(e){var t=domPN(i);val(t,e),addClass(t,"feedback_buttons_response")},onFail:function(e){if(e)return setTimeout((0,_web_lib_message_box__WEBPACK_IMPORTED_MODULE_7__.showFastBox)(getLang("global_error"),e).hide,3e3),!0},showProgress:function(){if(-2==a){i.oldhtml=i.innerHTML;var e=getSize(i)[0];i.innerHTML='<span class="progress_inline"></span>',setStyle(domFC(i),{width:e})}else(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton)(i)},hideProgress:function(){-2==a?i.innerHTML=i.oldhtml:(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton)(i)}})}},gn_grProcess:function(e,t,i,a,o,r){return o.stopPropagation(),hasClass(a,"flat_button")&&(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.isButtonLocked)(a)||domFC(a)&&"progress_inline"==domFC(a)||ajax.post("groupsedit.php",{act:"user_action",id:e,addr:t,hash:i,from:"top_notifier",action:r},{onDone:function(e){var t=domPN(a);return val(t,e),addClass(t,"feedback_buttons_response"),!1},onFail:function(e){return!!e&&(setTimeout((0,_web_lib_message_box__WEBPACK_IMPORTED_MODULE_7__.showFastBox)(getLang("global_error"),e).hide,3e3),!1)},showProgress:function(){(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton)(a)},hideProgress:function(){(0,_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton)(a)}}),!1},showGiftBox:function(e,t,i){return!showBox("al_gifts.php",{act:"get_gift_box",fids:e,fr:1,ref:i},{stat:["gifts.css","wide_dd.js","wide_dd.css"],cache:1,dark:1},t)},getSourcesTip:function(e,t){return cancelEvent(t),(0,_web_lib_tooltip_utils__WEBPACK_IMPORTED_MODULE_8__.showTooltip)(e,{url:"/al_page.php",params:{act:"notify_get_sources",cur_list:TopNotifierCur._qParams.list},slide:15,ajxdt:200,hidedt:200,dir:"bottom",shift:[100,10],id:"notify_sources",className:"notify_sources",onShowStart:function(){TopNotifierCur.notify_sources.forEach((function(e){val(geByClass1("notify_tooltip_counter"+e.list),e.counter>0?e.counter:"")})),TopNotifier.refreshTooltip()}}),!1},changeSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null!==i&&cancelEvent(i),e!==TopNotifierCur._qParams.list?(re(geByClass1("notify_sources")),t&&val(geByClass1("ui_rmenu_count",t),""),geByClass1("top_notify_show_all")&&attr(geByClass1("top_notify_show_all"),"href","/feed?section=notifications"+(e?"&list="+e:"")),TopNotifierCur._qParams.list=e,TopNotifier.refresh()):hide(geByClass1("notify_sources"))},changeSourceFullCallback:function(){TopNotifier.refreshCounters(),TopNotifierCur.notify_sources.forEach((function(e){e.list&&val(geByClass1("ui_rmenu_count",geByClass1("feed_section_"+e.list)),e.counter>0?e.counter:"")}));var e=geByTag1("a",geByClass1("header_side_link",geByClass1("feed_notifications")));""===TopNotifierCur.settings_url?hide(e):(show(e),attr(e,"href",TopNotifierCur.settings_url)),TopNotifierCur.source_name||(TopNotifierCur.source_name=getLang("news_title_notifications")),val(geByClass1("page_block_header_inner",geByClass1("feed_notifications")),TopNotifierCur.source_name)},hideBanner:function(e,t,i){ajax.post("al_feed.php",{act:"a_feedback_hide_banner",group_id:i,hash:t}),hide(ge("internal_notification131"))},addNewSource:function(e,t,i){return ajax.post("al_settings.php",{act:"a_group_notify_add_source",gid:e,from:i,hash:t},{onDone:function(t){nav.go("/settings?act=group_notify&gid="+e),TopNotifier.changeSource("group-"+e,null,null)},showProgress:_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.lockButton.pbind(cur.popupSubmitBtnEl),hideProgress:_web_lib_ui__WEBPACK_IMPORTED_MODULE_6__.unlockButton.pbind(cur.popupSubmitBtnEl)}),!0},refreshCounters:function(){var e=0,t=0,i=0,a=geByClass1("top_notify_header_label_groups_counter");TopNotifierCur.notify_sources.forEach((function(a){""!==a.list&&a.counter>0&&(1===a.unmuted?t++:e++),""===a.list&&(i=a.counter)})),vk.counts.ntf=i+t,TopNotifier.setCount(i+t,!0),TopNotifier.createNewEventsBox(i),t>0?(addClass(a,"unmuted"),val(a,t)):(removeClass(a,"unmuted"),val(a,e>0?e:""))},refreshTooltip:function(){var e=geByClass1("groups",geByClass1("notify_sources")),t=[],i=[],a=ce("div");e&&(geByClass("line_cell",e).forEach((function(e,a){val(geByClass1("ui_rmenu_count",e))>0?t.push(e):i.push(e)})),t.concat(i).forEach((function(e){a.appendChild(e)})),val(e,""),e.appendChild(a))},showCommonFriendsBox:function(e,t){return showTabbedBox("al_page.php",{act:"box",oid:t,tab:"common"},{cache:1},e),!1}},vk.widget||((0,_shared_evbus__WEBPACK_IMPORTED_MODULE_14__.tq)().setInteractiveHandler("Gifts/show_received_gifts",(e=>{var t=e.event,i=e.payload.dataAttrs.userId;showBox("al_gifts.php",{act:"box",tab:"received",mid:i},{cache:1,stat:["gifts.css",jsc("web/gifts.js")]},t)})),(0,_shared_evbus__WEBPACK_IMPORTED_MODULE_14__.tq)().setInteractiveHandler("Gifts/show_gifts_catalog",(e=>{var t=e.event,i=e.payload.dataAttrs,a=i.toId,o=i.ref;window.TopNotifier.showGiftBox(a,t,o)})))},781303:(e,t,i)=>{i(778440)("Int32",4,(function(e){return function(t,i,a){return e(this,t,i,a)}}))},967181:(e,t,i)=>{"use strict";i.d(t,{EntityType:()=>a,EventQueue:()=>r});var a,o=i(570655);!function(e){e.Online="online"}(a||(a={}));var r=function(e){var t=this,i=e.getQueue,a=e.registerQueue;this.QUEUE_KEY_TTL=3e3,this.MAX_RETRIES=5,this.listeners=[],this.retriesLeft=this.MAX_RETRIES,this.restart=function(){t.intervalId&&clearInterval(t.intervalId),0!==t.retriesLeft&&(t.retriesLeft--,t.getQueue().then((function(e){t.retriesLeft=t.MAX_RETRIES;var i=(0,o.__assign)({},e);t.intervalId=window.setInterval((function(){t.registerQueue(i,(function(e,a){var r,n,s,c;if(function(e){return void 0!==e.err}(a))t.restart();else{i.ts=a.ts;try{for(var l=(0,o.__values)(a.events),_=l.next();!_.done;_=l.next()){var d=_.value;try{for(var u=(s=void 0,(0,o.__values)(t.listeners)),f=u.next();!f.done;f=u.next())(0,f.value)(d)}catch(e){s={error:e}}finally{try{f&&!f.done&&(c=u.return)&&c.call(u)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{_&&!_.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}}))}),t.QUEUE_KEY_TTL)})).catch((function(e){console.error(e),setTimeout(t.restart,t.QUEUE_KEY_TTL)})))},this.subscribe=function(e){return t.listeners.push(e),1===t.listeners.length&&t.restart(),function(){t.listeners=t.listeners.filter((function(t){return t!==e})),0===t.listeners.length&&(t.retriesLeft=t.MAX_RETRIES,t.intervalId&&clearInterval(t.intervalId))}},this.registerQueue=a,this.getQueue=i}},49267:(e,t,i)=>{"use strict";i.d(t,{createLongpollConnect:()=>f});var a=i(570655),o=i(191040),r=i(887294),n=i(663825),s=i(19331),c=(0,s.partConfigEnabled)("me_web_read_by_cmid")?15:14;function l(e,t){e.waitAbortFns.push(t)}function _(e){if(e.isStoppedFn())return Promise.resolve({ts:0,updates:[]});var t=(0,r.plaingetCancelable)(e.url,{act:"a_check",key:e.key,version:e.version,ts:e.ts,wait:25,mode:e.mode}),i=t.request,n=t.cancel;return e.stopFn=n,i.then((function(t){var i=(0,a.__read)(t,2),o=i[0],r=i[1];return e.onData(e,r),e.waitTimeout=2,JSON.parse(o)})).catch((function(t){var i=(0,a.__read)(t,2)[1];return e.onData(e,i),Promise.reject(new Error(""))})).then((function(t){return function(e,t){var i=t.failed?(0,o.abortablePause)(4,null):{abort:function(){},pause:function(){return Promise.resolve()}},r=i.abort,n=i.pause;switch(t.failed){case 1:return l(e,r),e.onHistoryLost(e,t).then((function(){return e.onResult({ts:t.ts,updates:[[-1]]})})).then(n).then((function(){return _(e)}));case 2:return l(e,r),e.onKeyExpired(e,t).then((function(t){var i=(0,a.__read)(t,4),o=i[0],r=i[1],n=i[2],s=i[3];return e.onResult({ts:+s,updates:[[-2,o,r+"/"+n],[-1]]})})).then(n).then((function(){return _(e)}));case 3:return e.onLpBroken(e,t);default:return t.updates.some((function(e){switch(e[0]){case 4:return 4===e.length;case 5:case 18:return 3===e.length;default:return!1}}))?e.onHistoryLost(e,t).then((function(){return e.onResult({ts:t.ts,updates:[[-1]]})})).then(n).then((function(){return _(e)})):Promise.resolve(t)}}(e,t)}))}function d(e){e.isStoppedFn()||_(e).then(e.onResult.bind(e)).then((function(){return e.isReconnecting&&u(e,-5)})).catch((function(t){return function(e,t){if(e.isStoppedFn())return;e.onRequestError(t),e.waitTimeout=Math.min(60,2*e.waitTimeout),u(e,-3);var i=(0,o.abortablePause)(e.waitTimeout,null),a=i.abort,r=i.pause;return l(e,a),r().then((function(){return u(e,-4)}))}(e,t)})).then((function(){return d(e)}))}function u(e,t){e.isReconnecting=-4===t,e.onResult({ts:e.ts,updates:[[t,e.waitTimeout]]})}function f(e,t){var i=!!e.stopped,a={id:e.id,key:e.key,ts:e.ts,url:e.url,lpstat:e.lpstat||0,version:e.version||c,mode:1226,waitTimeout:2,waitAbortFns:[],isReconnecting:!1,isStoppedFn:function(){return i},onResult:function(e){e.ts&&r(a.ts,e.ts,e.updates.map(n.constructEvent))},onData:h(t.onData),onRequestError:h(t.onRequestError),onHistoryLost:p(t.onHistoryLost),onKeyExpired:p(t.onKeyExpired),onLpBroken:p(t.onHistoryLost)},o=t.onEvents;function r(e,t,i){a.ts=t;for(var r=0;r<i.length;++r)i[r].type===n.REFRESH_LP_KEY&&(a.key=i[r].key||"",a.url=i[r].url||"");o(e,t,i)}var s={options:a,isStopped:function(){return i},stopConnection:function(){i=!0,a.stopFn&&a.stopFn(),a.stopFn=void 0,document.removeEventListener("resume",l),this.abortWaiting()},reinitConnection:function(){this.stopConnection(),document.addEventListener("resume",l),u(a,-4),i=!1,d(a)},abortWaiting:function(){a.waitAbortFns.forEach((function(e){return e()})),a.waitAbortFns=[],a.waitTimeout=2},onLp:r};function l(){s.abortWaiting()}return document.addEventListener("resume",l),d(a),s}function h(e){return e||function(){}}function p(e){return e?function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return Promise.resolve(e.apply(void 0,(0,a.__spreadArray)([],(0,a.__read)(t))))}:function(){return Promise.reject()}}},384099:(e,t,i)=>{"use strict";i.d(t,{createLongpollEventsQueue:()=>o});var a=i(570655);function o(e,t,i){var o=0,r=e,n=[],s=!1;function c(){!n.length||o>0||s||(t(n),n=[])}return{pause:function(){o++},resume:function(){o>0&&(o--,c())},onLp:function(e,t,o){s||(r>=e?(r=t,n.push.apply(n,(0,a.__spreadArray)([],(0,a.__read)(o))),c()):i&&(s=!0,i(r).then((function(e){var t=(0,a.__read)(e,3),i=t[1],o=t[2];r=i,s=!1,n.push.apply(n,(0,a.__spreadArray)([],(0,a.__read)(o))),c()}))))}}}},421295:(e,t,i)=>{"use strict";i.d(t,{screenWakeLocker:()=>a});var a=new(function(){function e(){this.onVisibilityChange=this._onVisibilityChange.bind(this)}return e.prototype._onVisibilityChange=function(){this.wakeLockSentinel&&"visible"===document.visibilityState&&this.lock().then((function(){})).catch(console.error)},e.prototype.requestWakeLock=function(){var e=this;return navigator.wakeLock?this.wakeLockSentinel?Promise.resolve():navigator.wakeLock.request("screen").then((function(t){e.wakeLockSentinel=t})):Promise.reject()},e.prototype.isLocked=function(){return!!this.wakeLockSentinel&&!this.wakeLockSentinel.released},e.prototype.lock=function(){var e=this;return this.requestWakeLock().then((function(){e.wakeLockSentinel&&document.addEventListener("visibilitychange",e.onVisibilityChange)})).catch((function(){}))},e.prototype.unlock=function(){var e=this;return this.wakeLockSentinel?(document.removeEventListener("visibilitychange",this.onVisibilityChange),this.wakeLockSentinel.release().finally((function(){e.wakeLockSentinel=null}))):Promise.resolve()},e}())},603748:(e,t,i)=>{"use strict";i.d(t,{ConnectionLimiter:()=>o});var a=i(161644),o=function(){var e=this;this.scheduleReconnect=function(t,i,o){var r=i.onConnect,n=i.onOpen,s=i.onMessage,c=i.onClose;void 0===o&&(o=0),e.disconnect(),(0,a.log)("none","scheduling reconnection in",o);var l=function(){(0,a.log)("green","creating new EventSource");var i=new EventSource(t);setTimeout(r,0),i.addEventListener("open",n),i.addEventListener("message",(function(t){e.resetPingTimeout(c),s(t)})),i.addEventListener("ping-interval",(function(t){var i=JSON.parse(t.data);(0,a.log)("none","ping interval received",i),e.pingInterval=i})),i.addEventListener("ping",(function(){e.resetPingTimeout(c)})),i.addEventListener("error",(function(){switch((0,a.log)("red","EventSource error, readyState:",i.readyState),e.pingTimeoutId&&clearTimeout(e.pingTimeoutId),i.readyState){case EventSource.CONNECTING:case EventSource.OPEN:break;case EventSource.CLOSED:c()}})),e.source=i},_=window.setTimeout((function(){e.scheduled=void 0,l()}),o);e.scheduled={timeoutId:_,reconnect:l}},this.skipWaiting=function(){if(e.scheduled){var t=e.scheduled,i=t.timeoutId,a=t.reconnect;e.scheduled=void 0,clearTimeout(i),a()}},this.disconnect=function(){(0,a.log)("red","disconnecting EventSource"),e.scheduled&&(clearTimeout(e.scheduled.timeoutId),e.scheduled=void 0),e.pingTimeoutId&&clearTimeout(e.pingTimeoutId),e.source&&e.source.close()},this.isConnected=function(){return!!e.source&&e.source.readyState===EventSource.OPEN},this.resetPingTimeout=function(t){if(e.pingTimeoutId&&clearTimeout(e.pingTimeoutId),e.pingInterval){var i=e.pingInterval+1e3;e.pingTimeoutId=window.setTimeout((function(){(0,a.log)("red","connection ping timed out"),e.disconnect(),t()}),i)}}}},734693:(e,t,i)=>{"use strict";i.d(t,{DEPRECATEDLongpollAdapter:()=>l});var a=i(570655),o=i(170902),r=i(603748),n=i(663825),s=i(887294),c=i(161644),l=function(e,t,i,l){var _=this;this.buffer=[],this.paused=0,this.subscriptions=[],this.onData=function(e){_.subscriptions.push(e),_.unsubscribe||(_.unsubscribe=_.source.subscribe((function(e){var t,i,o,r=e.map(n.constructEvent);if(_.isPaused())(t=_.buffer).push.apply(t,(0,a.__spreadArray)([],(0,a.__read)(r)));else try{for(var s=(0,a.__values)(_.subscriptions),c=s.next();!c.done;c=s.next())c.value.apply(void 0,(0,a.__spreadArray)([],(0,a.__read)(r)))}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}})))},this.offData=function(e){_.subscriptions=_.subscriptions.filter((function(t){return t!==e})),0===_.subscriptions.length&&_.unsubscribe&&(_.unsubscribe(),_.unsubscribe=void 0)},this.push=function(e){var t,i;e.length>0&&"transition_event"!==e[0].type&&(0,c.log)("none","pushed events",e);try{for(var o=(0,a.__values)(_.subscriptions),r=o.next();!r.done;r=o.next())r.value.apply(void 0,(0,a.__spreadArray)([],(0,a.__read)(e)))}catch(e){t={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}},this.isPaused=function(){return _.paused>0},this.pause=function(){(0,c.log)("none","paused longpoll"),_.paused++},this.resume=function(){var e,t;if(0!==_.paused&&((0,c.log)("none","resumed longpoll"),_.paused--,0!==_.buffer.length)){var i=_.buffer;_.buffer=[];try{for(var o=(0,a.__values)(_.subscriptions),r=o.next();!r.done;r=o.next())r.value.apply(void 0,(0,a.__spreadArray)([],(0,a.__read)(i)))}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}},this.abortWaiting=function(){_.source.skipWaiting()},this.isEnabled=function(){return _.source.isConnected()},this.isSSE=!0,this.source=new o.ServerSentEvents(new r.ConnectionLimiter,{starterConfig:function(){return{key:e,ts:t,url:i,userId:l}},refreshedConfig:function(){return function(e){return new Promise((function(t,i){var a=!1,o=setTimeout((function(){a=!0,i(new Error("timeout"))}),1e3);(0,s.post)("al_im.php",{act:"a_get_key",uid:e,gid:Math.max(-e,0)},1e3).then((function(e){a||(t(e),clearTimeout(o))})).catch((function(e){a||(i(e),clearTimeout(o))}))}))}(l).then((function(e){var t=(0,a.__read)(e,4);return{key:t[0],url:t[1]+"/"+t[2],ts:t[3],userId:l}}))}})}},170902:(e,t,i)=>{"use strict";i.d(t,{ServerSentEvents:()=>n});var a=i(570655),o=i(668040),r=i(161644),n=function(e,t){var i=this,n=t.starterConfig,c=t.refreshedConfig;this.listeners=[],this.reconnect=function(e){if(void 0===e&&(e=200),(0,r.log)("none","new connection requested"),0!==i.listeners.length){var t=e>500;t&&i.simulate([-3,e/1e3]);var n=(0,o.toQueryString)({key:i.config.key,ts:i.config.ts,uid:i.config.userId,version:14,mode:1226});i.connectionLimiter.scheduleReconnect(i.config.url+"?"+n,{onConnect:function(){t&&i.simulate([-4])},onOpen:function(){(0,r.log)("green","connection opened"),e=200,i.simulate([-5])},onClose:function(){var t=s(e);(0,r.log)("red","connection closed, reconnect in",t),i.reconnect(t)},onMessage:function(t){var o,n,c=JSON.parse(t.data);if((0,r.log)("none","message received",c),void 0!==c.failed)switch(i.connectionLimiter.disconnect(),c.failed){case 1:i.simulate([-1]),i.config.ts=c.ts,i.reconnect();break;case 2:case 3:(0,r.log)("none","requesting new config"),i.refreshedConfig().then((function(e){(0,r.log)("none","new config received",e),i.config=(0,a.__assign)((0,a.__assign)({},e),{url:i.config.url}),i.simulate([-1]),i.reconnect()})).catch((function(t){(0,r.log)("red","error on updating key",t);var a=s(e);i.reconnect(a)}));break;case 4:throw new Error("Unknown longpoll version");default:throw new Error("Unknown longpoll error")}else{i.config.ts=c.ts;try{for(var l=(0,a.__values)(i.listeners),_=l.next();!_.done;_=l.next())(0,_.value)(c.updates)}catch(e){o={error:e}}finally{try{_&&!_.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}}}},e)}else(0,r.log)("none","no listeners, aborting reconnect")},this.skipWaiting=function(){i.isConnected()||(0,r.log)("none","skip waiting"),i.connectionLimiter.skipWaiting()},this.subscribe=function(e){return(0,r.log)("none","new client subscribed"),i.listeners.push(e),1===i.listeners.length&&i.reconnect(200),function(){(0,r.log)("none","client unsubscribed"),i.listeners.includes(e)&&(i.listeners=i.listeners.filter((function(t){return e!==t})),0!==i.listeners.length||i.connectionLimiter.disconnect())}},this.simulate=function(){for(var e,t,o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];(0,r.log)("none","simulating events",o);try{for(var s=(0,a.__values)(i.listeners),c=s.next();!c.done;c=s.next()){var l=c.value;l(o)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}},this.isConnected=function(){return i.connectionLimiter.isConnected()},this.config=n(),this.refreshedConfig=c,this.connectionLimiter=e};function s(e){return Math.min(2*e,6e4)}},161644:(e,t,i)=>{"use strict";i.d(t,{log:()=>o});var a=i(570655);function o(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=function(e){return e<10?"0"+e.toString():e.toString()},r=new Date,n=r.getHours()+":"+o(r.getMinutes())+":"+o(r.getSeconds()),s="background: "+e+"; color: white";window.__sseDebug&&console.debug.apply(console,(0,a.__spreadArray)(["%c"+n+" SSE:",s],(0,a.__read)(t)))}window.sseDebug=function(e){window.__sseDebug=e,window.__debugMode=e}},597332:(e,t,i)=>{"use strict";i.d(t,{MARKET_NOTIFY_ID__HS_MIGRATION_STATE:()=>n,onHappySantaMarketMigrationStateChanged:()=>c});var a=i(718253),o=i(315544),r=i(654612),n="happy_santa_market_migration_state";function s(){window.wkcur&&window.cur&&window.WkView&&(window.wkcur.onHide=null,window.cur.isMigrateAvailable=!1,window.WkView.hide())}function c(e){if(void 0!==e.add&&void 0!==e.add.state&&void 0!==e.add.group_id){var t=Number(e.add.state),i=Number(e.add.group_id);if(1!==t)switch(t){case 3:var n=a.GROUP_ORDERS_DEFAULT_COLUMNS.map((function(e,t){return{id:e,order:t,isEnabled:"merchantComment"!==e&&"deliveryOption"!==e}})),c=a.GROUP_ORDERS_COLUMNS_STORAGE_KEY+"_"+i;window.ls.set(c,n);var l=document.querySelector("#group_edit_market_settings_link");l&&(0,o.show)(l),s();break;case 2:s();var _=e.add.info_title?String(e.add.info_title):"",d=e.add.info_text?String(e.add.info_text):"";_&&d&&window.cur.isMigrationInProgress&&(0,r.showFastBox)(_,d)}}}},533143:(e,t,i)=>{"use strict";var a=i(612202);window.DesktopNotifications={supported:function(){return!!window.Notification},checkPermissionNeeded:function(){return"granted"===Notification.permission?0:1},requestPermission:function(e){window.Notification.requestPermission(e).finally((function(){}))},createNotification:function(e,t,i){var o;return(o=new Notification(t,{icon:e,body:i})).cancel=function(){this.close()},o.show=function(){},(0,a.statlogsProbValueEvent)(.1,"browser_notification",1),o}}},988058:(e,t,i)=>{"use strict";i.d(t,{createLongpoll:()=>c});var a=i(49267),o=i(437361),r=i(887294),n=i(454593),s=i(460615);function c(e,t){return(0,a.createLongpollConnect)(e,{onEvents:t,onData:d,onRequestError:u,onHistoryLost:f,onKeyExpired:h,onLpBroken:p})}var l={},_=Date.now();function d(e,t){if(t&&t.status&&e.lpstat){var i=t.status.toString();t.status>=500&&t.status<600&&(0,s.statlogsValueEvent)("fc_longpoll",1,i,t.getResponseHeader("x-frontend")||""),l[i]=i in l?l[i]+1:1,Date.now()-_>=3e4&&(Object.keys(l).forEach((function(e){(0,s.statlogsValueEvent)("fc_longpoll",l[e],e,t.getResponseHeader("x-frontend")||"")})),l={},_=Date.now())}}function u(e){(0,o.lpLogFc)("red","LP error",e.message||"no message (probably browser reset)")}function f(e,t){(0,o.lpLogFc)("red","LP failed: old timestamp; resync, next ts",t.ts)}function h(e){return(0,o.lpLogFc)("red","LP failed: key is incorrect; refresh key"),(0,r.post)(n.CONTROLLER,{act:"a_get_key",uid:e.id,gid:e.id<0?-e.id:0},1e3)}function p(){throw window.nav.reload({force:!0}),new Error("ts is very wrong")}},437361:(e,t,i)=>{"use strict";i.d(t,{lpLogFc:()=>r,longpollTestingOnFcEvents:()=>u});var a=i(570655),o=i(968958);function r(e,t){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];if(window.vk.lpConfig.debug){var r="background: "+e+"; color: white",n=new Date,s=function(e){return e<10?"0"+e.toString():e.toString()};console.log.apply(console,(0,a.__spreadArray)(["%c "+n.getHours()+":"+s(n.getMinutes())+":"+s(n.getSeconds())+":"+n.getMilliseconds()+" "+t+" ",r],(0,a.__read)(i)))}}function n(){return window.lpBufferFc||(window.lpBufferFc=[]),window.lpBufferFc}function s(){return window.lpBufferIm||(window.lpBufferIm=[]),window.lpBufferIm}function c(e,t){var i;window.lpWeird||(window.lpWeird=[]),window.lpWeird.push({msg:e,ev:t,is_master:!!(null===(i=window.curNotifier)||void 0===i?void 0:i.is_server)}),setTimeout(l,1e4)}function l(){window.lpWeird&&window.lpWeird.length&&((0,o.imWeirdLog)("fc_im_differ",{diff:window.lpWeird},!1),window.lpWeird=[])}function _(){return"im"===window.cur.module&&window.store&&window.store.get().longpoll&&!window.store.get().stopped}function d(){var e;_()&&(s().forEach((function(e){!n().find((function(t){return e.ev===t.ev}))&&e.time<Date.now()-1e3&&!e.warned&&(e.warned=!0,r("red","im not fc",e.ev),(0,o.isWeirdLogging)()&&c("im not fc",e.ev))})),n().forEach((function(e){var t=s().find((function(t){return t.ev===e.ev}));t&&t.warned&&!e.warned&&(e.warned=!0,r("red","now fc like im",e.ev),(0,o.isWeirdLogging)()&&c("now fc like im",e.ev))}))),e=Date.now()-3e4,window.lpBufferFc=n().filter((function(t){return t.time>e})),window.lpBufferIm=s().filter((function(t){return t.time>e}))}function u(e){var t;_()&&((t=n()).push.apply(t,(0,a.__spreadArray)([],(0,a.__read)(e.map((function(e){return{time:Date.now(),ev:JSON.stringify(e),warned:!1}}))))),setTimeout(d,0)),r.apply(void 0,(0,a.__spreadArray)(["green","fc"],(0,a.__read)(e)))}window.longpollTestingOnImEvents=function(e){var t;_()&&((t=s()).push.apply(t,(0,a.__spreadArray)([],(0,a.__read)(e.map((function(e){return{time:Date.now(),ev:JSON.stringify(e),warned:!1}}))))),setTimeout(d,1100)),r.apply(void 0,(0,a.__spreadArray)(["blue","im"],(0,a.__read)(e)))}},316031:(e,t,i)=>{"use strict";i.d(t,{lpSingletonGetInstance:()=>g,lpSingletonOnTabInitialLoaded:()=>m,lpSingletonSyncWithNotifier:()=>b,lpSingletonOnNotifierRecv:()=>C});var a=i(988058),o=i(384099),r=i(437361),n=i(968958),s=i(726271),c=i(695724),l=i(194795),_=i.n(l),d=window.lpConnect,u=window.lpInstance;function f(){return window.vk.id>0}function h(){return window.curNotifier&&window.curNotifier.lp_connected}function p(){return window.curNotifier&&window.curNotifier.is_server||s.browser.safari}function v(e,t,i){u.onLp(e,t,i),h()&&p()&&(e!=t||i.length)&&function(e,t,i){window.Notifier.lcSend("lp_data",{tsOld:e,tsNow:t,evs:i}),(0,r.lpLogFc)("silver","broadcast to others",e,t,i)}(e,t,i)}function g(){return f()?(u||(window.vk.lpConfig.url&&0!==window.vk.lpConfig.enabled||(window.vk.lpConfig.stopped=!0),window.vk.lpConfig.id=window.vk.id,window.lpConnect=d=(0,a.createLongpoll)(window.vk.lpConfig,v),e=new(_()),t=(0,o.createLongpollEventsQueue)(window.vk.lpConfig.ts,(function(t){(0,r.longpollTestingOnFcEvents)(t),e.trigger("data",t)}),w),window.lpInstance=u={onData:function(t){e.on("data",t)},offData:function(t){e.off("data",t)},pause:function(){t.pause()},resume:function(){t.resume()},push:function(t){e.trigger("data",t)},abortWaiting:function(){d.abortWaiting()},onLp:function(e,i,a){t.onLp(e,i,a)},isEnabled:function(){return d&&!d.isStopped()}}),u):null;var e,t}function m(){f()&&((0,r.lpLogFc)("orange","init longpoll connection on load"),g(),window.curNotifier.idle_manager.on("unidle",(function(){d.abortWaiting()})),b())}function b(){f()&&(h()?d.isStopped()&&p()?((0,r.lpLogFc)("orange","now master, init connection"),(0,n.imWeirdLog)("fc_longpoll_master",{},!1),d.reinitConnection()):d.isStopped()||p()||((0,r.lpLogFc)("orange","now slave, stop connection"),(0,n.imWeirdLog)("fc_longpoll_slave",{},!1),d.stopConnection()):setTimeout(b,500))}function C(e){h()&&!p()&&f()&&((0,r.lpLogFc)("silver","recv from master",e.tsOld,e.tsNow,e.evs),d.onLp(e.tsOld,e.tsNow,e.evs))}function w(e){var t=(0,c.extend)({},window.lpConnect.options,{ts:e});return(0,r.lpLogFc)("orange","createLongpoll to load from",e),new Promise((function(e){var i=(0,a.createLongpoll)(t,(function(t,a,o){(0,r.lpLogFc)("orange","Loaded ["+t+","+a+")"),i.stopConnection(),e([t,a,o])}))}))}},16850:(e,t,i)=>{"use strict";function a(e){var t,i;if(null!==(i=t=e)&&"object"==typeof i&&("queue"in t||"key"in t&&"string"==typeof t.key))return e.queue||e.key}i.d(t,{subscriptionObjectStableId:()=>a})}},__webpack_module_cache__={},deferred,leafPrototypes,getProto,inProgress;function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.m=__webpack_modules__,deferred=[],__webpack_require__.O=(e,t,i,a)=>{if(!t){var o=1/0;for(c=0;c<deferred.length;c++){for(var[t,i,a]=deferred[c],r=!0,n=0;n<t.length;n++)(!1&a||o>=a)&&Object.keys(__webpack_require__.O).every((e=>__webpack_require__.O[e](t[n])))?t.splice(n--,1):(r=!1,a<o&&(o=a));if(r){deferred.splice(c--,1);var s=i();void 0!==s&&(e=s)}}return e}a=a||0;for(var c=deferred.length;c>0&&deferred[c-1][2]>a;c--)deferred[c]=deferred[c-1];deferred[c]=[t,i,a]},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},getProto=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,__webpack_require__.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var i=Object.create(null);__webpack_require__.r(i);var a={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var o=2&t&&e;"object"==typeof o&&!~leafPrototypes.indexOf(o);o=getProto(o))Object.getOwnPropertyNames(o).forEach((t=>a[t]=()=>e[t]));return a.default=()=>e,__webpack_require__.d(i,a),i},__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.f={},__webpack_require__.e=e=>Promise.all(Object.keys(__webpack_require__.f).reduce(((t,i)=>(__webpack_require__.f[i](e,t),t)),[])),__webpack_require__.u=e=>38288===e?"lottie.7d914fa3404556039ac3.js":40885===e?"audioplayer.198efba98031d5b51267.js":58042===e?"11cdaa76d93e3e29e182f89ef3670afb.8f165c9d67ec9eb35138.js":11700===e?"fastchat_reforged.551ec3ddfed7f4d897e9.js":void 0,__webpack_require__.miniCssF=e=>{},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),inProgress={},__webpack_require__.l=(e,t,i,a)=>{if(inProgress[e])inProgress[e].push(t);else{var o,r;if(void 0!==i)for(var n=document.getElementsByTagName("script"),s=0;s<n.length;s++){var c=n[s];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="vk:"+i){o=c;break}}o||(r=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,__webpack_require__.nc&&o.setAttribute("nonce",__webpack_require__.nc),o.setAttribute("data-webpack","vk:"+i),o.src=e),inProgress[e]=[t];var l=(t,i)=>{o.onerror=o.onload=null,clearTimeout(_);var a=inProgress[e];if(delete inProgress[e],o.parentNode&&o.parentNode.removeChild(o),a&&a.forEach((e=>e(i))),t)return t(i)},_=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),r&&document.head.appendChild(o)}},__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="/dist/",(()=>{var e={90675:0};__webpack_require__.f.j=(t,i)=>{var a=__webpack_require__.o(e,t)?e[t]:void 0;if(0!==a)if(a)i.push(a[2]);else{var o=new Promise(((i,o)=>a=e[t]=[i,o]));i.push(a[2]=o);var r=__webpack_require__.p+__webpack_require__.u(t),n=new Error;__webpack_require__.l(r,(i=>{if(__webpack_require__.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var o=i&&("load"===i.type?"missing":i.type),r=i&&i.target&&i.target.src;n.message="Loading chunk "+t+" failed.\n("+o+": "+r+")",n.name="ChunkLoadError",n.type=o,n.request=r,a[1](n)}}),"chunk-"+t,t)}},__webpack_require__.O.j=t=>0===e[t];var t=(t,i)=>{var a,o,[r,n,s]=i,c=0;for(a in n)__webpack_require__.o(n,a)&&(__webpack_require__.m[a]=n[a]);if(s)var l=s(__webpack_require__);for(t&&t(i);c<r.length;c++)o=r[c],__webpack_require__.o(e,o)&&e[o]&&e[o][0](),e[r[c]]=0;return __webpack_require__.O(l)},i=self.webpackChunkvk=self.webpackChunkvk||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var __webpack_exports__=__webpack_require__.O(void 0,[68592,24509,6970],(()=>__webpack_require__(876109)));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();